Closed Bug 511040 Opened 16 years ago Closed 16 years ago

NJ: flesh out the hashtable in nanojit/Containers.h a bit

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.2 --- beta1-fixed

People

(Reporter: graydon, Assigned: graydon)

References

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

The nanojit allocator-based hashtable type has some implementation inefficiencies (it takes and returns by-value structures, where it could use const &), and limits itself to int32_t for no reason I can see, and also doesn't handle general key types. The attached patch fixes these issues. The provided general-purpose hash is murmurhash 2, a relatively fast word-based one popular these days among the cool kids. It's done as a template parameter on the hashtable so we can use different ones too (I'm intending to use different ones for the JIT cache tables that are replacing Fragmento).
Attachment #394988 - Flags: review?(edwsmith)
any profile data? in other cases we've specialized the hash function for one-word (pointer) values, and most if not all current uses of HashMap fit this pattern, using either NIns* or LIns* as keys. This is also why the current code used K directly instead of const K& for key values.
No profile data driving it, no. I'm just beginning to use it to store non-pointer key structures, figured I'd avoid calling all the copy constructors. I imagine it'll run *ok* either way, we're talking 3-5 word key structures, usually. I'd prefer to keep the signatures const & just to avoid thinking about key and value sizes, but can omit that if you feel strongly. I'm happy to make a specialization of the hasher, at least, for word-sized keys.
Attachment #394988 - Flags: review?(edwsmith) → review+
Comment on attachment 394988 [details] [diff] [review] Brand new shiny bits I dont feel strongly about const &, at least until we get some evidence of a problem, sounds fine
Blocks: 511309
http://hg.mozilla.org/tracemonkey/rev/82528a81a981 (with partial specialization for pointer keys, restoring the old hash)
Whiteboard: fixed-in-tracemonkey
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: