Bug 1098618 - Use a smaller initial IdSet size in jsiter.cpp:Snapshot(). r=sfink.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 13 Nov 2014 18:06:24 -0800
changeset 215668 fd662a7e86879b84d925985f43fa6016614c65c5
parent 215667 b0fa2c0b753d21d8b046cfad594620f7daab0f71
child 215669 5a2271cb4a6760cdf574bd6ff4c850f3ffaf1091
push id51821
push usernnethercote@mozilla.com
push dateFri, 14 Nov 2014 02:57:37 +0000
treeherdermozilla-inbound@fd662a7e8687 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1098618
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1098618 - Use a smaller initial IdSet size in jsiter.cpp:Snapshot(). r=sfink.
js/src/jsiter.cpp
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -268,18 +268,19 @@ struct SortComparatorIds
     }
 };
 
 #endif /* JS_MORE_DETERMINISTIC */
 
 static bool
 Snapshot(JSContext *cx, HandleObject pobj_, unsigned flags, AutoIdVector *props)
 {
+    // ~90% of the time this table ends up with 3 or fewer elements.
     IdSet ht(cx);
-    if (!ht.init(32))
+    if (!ht.init(3))
         return false;
 
     RootedObject pobj(cx, pobj_);
 
     do {
         const Class *clasp = pobj->getClass();
         if (pobj->isNative() &&
             !pobj->getOps()->enumerate &&