Skip to content

Conversation

@calumptrck
Copy link

@calumptrck calumptrck commented Nov 17, 2019

I was able to get a better perf results by using Array.prototype.concat to create a new array with the additional args needed, instead of mutating the value being flattened twice with unshift and splice.

Results:

Screen Shot 2019-11-17 at 12 04 02 AM

I also gave array.splice.call(array, i,1,...value) a shot which would transpile to array.call.apply(array.splice, [array, i, 1].concat(value)) but the benchmark was about the same.

edit: Tests are passing aside from verify optimizability -> with empty array, which wasn't passing originally on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling ba13cd5 on calumptrck:with-concat into 772d0dd on elidoran:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants