Bug 114030

Summary: Avoid double hash table lookups in TextureMapperGL
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebCore Misc.Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: cmarcelo, commit-queue, jturcotte, kenneth, laszlo.gombos, luiz, noam, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Chris Dumez 2013-04-05 06:03:26 PDT
In TextureMapperGL, we often need to check if a key is present in the hash table:
- if it is return the associated value,
- if it is not create the value, add it to the hash table and return it.

We currently use Vector::find() to check if it exists, and then Vector::set() to add the value to the hash table if it doesn't. This results in  2 hash lookups. We could leverage the AddResult return value of Vector::add() to do the same thing with a single hash lookup.
Comment 1 Chris Dumez 2013-04-05 06:07:33 PDT
Created attachment 196623 [details]
Patch
Comment 2 Noam Rosenthal 2013-04-05 06:16:42 PDT
Comment on attachment 196623 [details]
Patch

Seems a bit like a micro-optimization, as those cases only happen the first time you use a particular shader/vbo.
But OK :)
Comment 3 WebKit Commit Bot 2013-04-05 06:24:28 PDT
Comment on attachment 196623 [details]
Patch

Clearing flags on attachment: 196623

Committed r147742: <http://trac.webkit.org/changeset/147742>
Comment 4 WebKit Commit Bot 2013-04-05 06:24:30 PDT
All reviewed patches have been landed.  Closing bug.