Bug 191621

Summary: Add cache for CommitLog objects to avoid refetching same commit.
Product: WebKit Reporter: dewei_zhu
Component: New BugsAssignee: dewei_zhu
Status: RESOLVED FIXED    
Severity: Normal CC: dewei_zhu, rniwa
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch rniwa: review+

dewei_zhu
Reported 2018-11-13 20:25:25 PST
Add cache for CommitLog objects to avoid refetching same commit.
Attachments
Patch (14.11 KB, patch)
2018-11-13 20:32 PST, dewei_zhu
no flags
Patch (15.41 KB, patch)
2018-11-13 21:19 PST, dewei_zhu
no flags
Patch (18.40 KB, patch)
2018-11-13 22:32 PST, dewei_zhu
rniwa: review+
dewei_zhu
Comment 1 2018-11-13 20:32:50 PST
Ryosuke Niwa
Comment 2 2018-11-13 20:43:48 PST
Comment on attachment 354760 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=354760&action=review > Websites/perf.webkit.org/ChangeLog:11 > + (CommitLog): Added assertion for id. Removed unused 'remoteId'. Refer to r198479 where the relevant code was removed. > Websites/perf.webkit.org/public/v3/models/commit-log.js:174 > + const commit = this.ensureNamedStaticMap(`repository-${repository.id()}`)[revision]; ensureNamedStaticMap shouldn't be called with a dynamically generated name like this because it would be slow. In general, ensureNamedStaticMap is designed to work with a small fixed number of maps. Instead, this.ensureNamedStaticMap('repositoryMap') should have a map. Maybe an even better design is for each instance of a Repository object to have this map although it's slightly inelegant to reference CommitLog and Repository like that.
dewei_zhu
Comment 3 2018-11-13 21:19:12 PST
Ryosuke Niwa
Comment 4 2018-11-13 21:42:24 PST
Comment on attachment 354765 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=354765&action=review > Websites/perf.webkit.org/public/v3/models/commit-log.js:174 > + const commit = repository.ensureNamedStaticMap('revision')[revision]; Oh, no, that's not what I mean. ensureNamedStaticMap is per class so this is simply an alias to Repository.ensureNamedStaticMap('revision') You'd have to create your own instance variable on Repository. Please add a test for this. If you called fetchForSingleRevision on two different repositories, it would override each other with the current patch.
dewei_zhu
Comment 5 2018-11-13 22:32:46 PST
Ryosuke Niwa
Comment 6 2018-11-13 22:54:55 PST
Comment on attachment 354772 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=354772&action=review > Websites/perf.webkit.org/ChangeLog:12 > + Removed unused 'remoteId' has it has been removed since r198479. s/has it has/as it has/ > Websites/perf.webkit.org/public/v3/models/repository.js:38 > + No need for a blank line here.
dewei_zhu
Comment 7 2018-11-13 23:37:13 PST
Landed in r238167
Note You need to log in before you can comment on or make changes to this bug.