Bug 114030 - Avoid double hash table lookups in TextureMapperGL
Summary: Avoid double hash table lookups in TextureMapperGL
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-05 06:03 PDT by Chris Dumez
Modified: 2013-04-05 06:24 PDT (History)
8 users (show)

See Also:


Attachments
Patch (5.92 KB, patch)
2013-04-05 06:07 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.