Skip to content

Assign thunk to null instead of using delete #16

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

Merged
merged 1 commit into from
Sep 18, 2016

Conversation

no-longer-on-githu-b
Copy link
Contributor

@no-longer-on-githu-b no-longer-on-githu-b commented Sep 16, 2016

For:

for (var i = 0; i < 1e6; ++i) {
  var x = defer(function() {
    return 1;
  });
  for (var j = 0; j < 100; ++j) {
    x.force();
    x.force();
    x.force();
    x.force();
  }
}

I get 16 seconds with delete and 9 seconds with null, consistently, in Chrome.

delete causes V8 to change the object representation to a more
inefficient one.

Fixes #15.
@garyb garyb merged commit b5a5dca into purescript:master Sep 18, 2016
@garyb
Copy link
Member

garyb commented Sep 18, 2016

I thought I'd made this change a while back actually. delete should be avoided at all costs unless the thing is going to be checked with hasOwnProperty!

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