Re: mozilla::Hash{Map,Set}

2018-08-16 Thread Nicholas Nethercote
ch their own. > About that last sentence: - Default infallible: true, although I removed the init() function from mozilla::Hash{Map,Set} (by making allocation lazy, waiting until first insertion) so at least you don't have to worry about that any more. - Plenty of predefined hashes: mozilla:

Re: mozilla::Hash{Map,Set}

2018-08-16 Thread Nicholas Nethercote
On Fri, Aug 17, 2018 at 3:10 AM, Kris Maglione wrote: > > It would probably worth converging the APIs, if only because the > nsTHashtable APIs are arcane and antiquated. But it's easier said than > done. There are a lot of consumers of all of the hashtable APIs, and the > code is... not very easy

Re: mozilla::Hash{Map,Set}

2018-08-16 Thread Kris Maglione
idermonkey's js::Hash{Map,Set} classes from js/public/HashTable.h into mfbt/HashTable.h and renamed them as mozilla::Hash{Map,Set}. They can now be used throughout Gecko. (js/public/HashTable.h still exists in order to provide renamings of mozilla::Hash{Map,Set} as js::Hash{Map,Set}.) Why m

Re: mozilla::Hash{Map,Set}

2018-08-16 Thread Eric Rahm
e place rather than two. [2] https://bugzilla.mozilla.org/show_bug.cgi?id=1402910 -e > Alex > > > On Wed, Aug 15, 2018 at 5:39 AM Nicholas Nethercote < > n.netherc...@gmail.com> > wrote: > > > Hi, > > > > I recently moved Spidermonkey's js:

Re: mozilla::Hash{Map,Set}

2018-08-16 Thread Alex Gaynor
cently moved Spidermonkey's js::Hash{Map,Set} classes from > js/public/HashTable.h into mfbt/HashTable.h and renamed them as > mozilla::Hash{Map,Set}. They can now be used throughout Gecko. > > (js/public/HashTable.h still exists in order to provide renamings of > mozilla::Has

Re: mozilla::Hash{Map,Set}

2018-08-15 Thread Kris Maglione
On Wed, Aug 15, 2018 at 07:28:26PM -0400, Ehsan Akhgari wrote: On Wed, Aug 15, 2018 at 5:39 AM Nicholas Nethercote wrote: Bug 1477627 converted a hot hash table from PLDHashTable to mozilla::HashSet and appears to have sped up cycle collection in some cases by 7%. If you know of another PLDHash

Re: mozilla::Hash{Map,Set}

2018-08-15 Thread Kris Maglione
On Wed, Aug 15, 2018 at 01:18:23PM -0700, Jeff Gilbert wrote: What are the pros/cons to mozilla::Hash{Map,Set} vs std::unordered_{map,set}? I'm assuming perf is the main draw? Do we have a data on this too? According to our benchmarks, mozilla::HashMap is much faster than std::unordere

Re: mozilla::Hash{Map,Set}

2018-08-15 Thread Ehsan Akhgari
This is great work, thanks a lot, Nick! On Wed, Aug 15, 2018 at 5:39 AM Nicholas Nethercote wrote: > Bug 1477627 converted a hot hash table from PLDHashTable to > mozilla::HashSet and appears to have sped up cycle collection in some cases > by 7%. If you know of another PLDHashTable that is hot,

Re: mozilla::Hash{Map,Set}

2018-08-15 Thread Nicholas Nethercote
On Thu, Aug 16, 2018 at 9:28 AM, Ehsan Akhgari wrote: > > Do you have any good suggestions of how to find such candidates? One > thing that came to my mind was that the BHR data may be a useful source of > insight for this... category=all&durationSpec=512_2048&in

Re: mozilla::Hash{Map,Set}

2018-08-15 Thread Nicholas Nethercote
Off the top of my head, the advantages of mozilla::Hash{Map,Set} over std::unordered_{map,set} are the following. - They are much faster on Mac and Linux and not much different on Windows: https://treeherder.mozilla.org/perf.html#/graphs?timerange=604800&series= mozilla-central,1732084

Re: mozilla::Hash{Map,Set}

2018-08-15 Thread Jeff Gilbert
Awesome! What are the pros/cons to mozilla::Hash{Map,Set} vs std::unordered_{map,set}? I'm assuming perf is the main draw? Do we have a data on this too? On Mon, Aug 13, 2018 at 10:44 PM, Nicholas Nethercote wrote: > Hi, > > I recently moved Spidermonkey's js::Hash{Map,Set

mozilla::Hash{Map,Set}

2018-08-15 Thread Nicholas Nethercote
Hi, I recently moved Spidermonkey's js::Hash{Map,Set} classes from js/public/HashTable.h into mfbt/HashTable.h and renamed them as mozilla::Hash{Map,Set}. They can now be used throughout Gecko. (js/public/HashTable.h still exists in order to provide renamings of mozilla::Hash{Map,Set}