petkaantonov/deque

Native array is faster than this[]

Opened this issue ยท 5 comments

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. ๐Ÿ™ˆ

image

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