Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Immutable cache array #640

Closed
wants to merge 7 commits into from
Closed

Immutable cache array #640

wants to merge 7 commits into from

Conversation

peakji
Copy link
Member

@peakji peakji commented May 31, 2019

Implemented two minor changes that might give us a performance gain:

  • No need to reverse the array in C++ land, this will avoid creating slow arrays with holes.
  • Remove .pop() operations in JS land, leave the cache array immutable.

I haven't run the benchmarks yet, @vweevers is there any benchmark script suitable for this one?

Note: I forked this brach from remove-fast-future, I'll rebase after #638 gets merged.

@peakji peakji added enhancement New feature or request benchmark Requires or pertains to benchmarking labels May 31, 2019
@@ -54,7 +46,6 @@ Iterator.prototype._next = function (callback) {
}

Iterator.prototype._end = function (callback) {
delete this.cache
Copy link
Member Author

@peakji peakji May 31, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see tests failed on checking the cache size after calling .end(), is there a particular reason to manually delete the cache array here?

AFAIK, deleting properties of a class is not a recommended practice since it might affect V8's hidden class.

@vweevers
Copy link
Member

I haven't run the benchmarks yet, @vweevers is there any benchmark script suitable for this one?

Was working on that but I fell into a rabbit hole 😄 Climbing out!

@vweevers
Copy link
Member

vweevers commented Jun 2, 2019

Climbed out. No actual benchmark written yet, only goodies: keyspace, zipfian-integer, uniform-integer, pseudo-random-buffer and pseudo-math-random.

@ralphtheninja
Copy link
Member

@vweevers you're on a roll!

@peakji peakji mentioned this pull request Jun 13, 2019
@peakji
Copy link
Member Author

peakji commented Jun 14, 2019

My little benchmark script shows these changes just made things slower 😢: #638 (comment) .

I'm closing this PR now but feel free to reopen.

@peakji peakji closed this Jun 14, 2019
@peakji peakji deleted the immutable-cache-array branch June 14, 2019 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark Requires or pertains to benchmarking enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants