Bug 21633 - Avoid using a HashMap when there is only a single transition
Summary: Avoid using a HashMap when there is only a single transition
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Cameron Zwarich (cpst)
URL:
Keywords:
Depends on:
Blocks: 21513
  Show dependency treegraph
 
Reported: 2008-10-15 17:43 PDT by Cameron Zwarich (cpst)
Modified: 2008-10-15 21:38 PDT (History)
0 users

See Also:


Attachments
Proposed patch (5.60 KB, patch)
2008-10-15 19:10 PDT, Cameron Zwarich (cpst)
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron Zwarich (cpst) 2008-10-15 17:43:52 PDT
We have determined through testing that the vast majority of StructureIDs have only 0 or 1 transition. We should not create a whole HashMap in these cases.
Comment 1 Cameron Zwarich (cpst) 2008-10-15 19:10:55 PDT
Created attachment 24382 [details]
Proposed patch

It would be nice if someone else (Maciej?) ran benchmarks on his own machine to verify.
Comment 2 Maciej Stachowiak 2008-10-15 20:46:42 PDT
Comment on attachment 24382 [details]
Proposed patch

r=me

But it would be nice if we could abstract away the single-transition optimization a bit, by having some helper functions that hide the core logic (e.g. one to get an existing transition for a property - it could check either the single entry or the hashtable as appropriate) etc.
Comment 3 Cameron Zwarich (cpst) 2008-10-15 21:38:07 PDT
Landed in r37627.