summaryrefslogtreecommitdiff
path: root/test/parallel/test-freelist.js
diff options
context:
space:
mode:
authorAnton Khlynovskiy <subzey@gmail.com>2016-01-26 15:13:12 +0300
committerAli Sheikh <ofrobots@lemonhope.roam.corp.google.com>2016-03-02 09:24:24 -0800
commitc647e87504ad1855cad243bd4b3f9b78764a1144 (patch)
treeb3e87dd49853607cf435edfb941d8bedd950450b /test/parallel/test-freelist.js
parent6361c049a926e24f227469cfdf2af58df383847c (diff)
downloadandroid-node-v8-c647e87504ad1855cad243bd4b3f9b78764a1144.tar.gz
android-node-v8-c647e87504ad1855cad243bd4b3f9b78764a1144.tar.bz2
android-node-v8-c647e87504ad1855cad243bd4b3f9b78764a1144.zip
lib: freelist: use .pop() for allocation
Array#pop() is known to be faster than Array#shift(). To be exact, it's O(1) vs. O(n). In this case there's no difference from which side of the "pool" array the object is retrieved, so .pop() should be preferred. PR-URL: https://github.com/nodejs/node/pull/2174 Reviewed-By: mscdex - Brian White <mscdex@mscdex.net> Reviewed-By: jasnell - James M Snell <jasnell@gmail.com> Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'test/parallel/test-freelist.js')
-rw-r--r--test/parallel/test-freelist.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/parallel/test-freelist.js b/test/parallel/test-freelist.js
index 270ff4ec00..feb5dcc9a9 100644
--- a/test/parallel/test-freelist.js
+++ b/test/parallel/test-freelist.js
@@ -27,6 +27,6 @@ assert.strictEqual(flist1.free('test4'), false);
assert.strictEqual(flist1.free('test5'), false);
// At this point 'alloc' should just return the stored values
-assert.strictEqual(flist1.alloc(), 'test1');
-assert.strictEqual(flist1.alloc(), 'test2');
assert.strictEqual(flist1.alloc(), 'test3');
+assert.strictEqual(flist1.alloc(), 'test2');
+assert.strictEqual(flist1.alloc(), 'test1');