deque
deque copied to clipboard
Native array is faster than this[]
I'm getting significantly faster performance using a native array this.arr = [];
and replacing all instances of this[]
with this.arr[]
. Running the two_million benchmark, I'm getting ~23 milllion ops/s with this[]
vs 25-26 million ops/s using this.arr[]
Thoughts?
Darwin 13.4.0 x64 Node.JS 4.1.2 V8 4.5.103.35 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz × 8
@yzarubin there's this and quite a few other things that can be done for perf on deque.
But, with the lack of maintenance on this repo I ended up rolling my own double-ended queue which well out performs this. 🙈
PRs welcome of course :) it has been 2-3 years so it's expected some things have been changed in v8 :P
@petkaantonov I considered PR'ing this, but I didn't know where to start as it was different implementation and was concerned the PR would sit there and go mouldy 😄
Was helpful though seeing how you initially approached things, always looking through your source code like the stalker that I am. 🌝
@Salakar you should submit a PR so all the dependents can benefit :)
@calebboyd I didn't want to be 'that guy' =]
You're more than welcome to do one however