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

Optimization: avoid checking null proto twice #4905

Closed
wants to merge 1 commit into from
Closed

Optimization: avoid checking null proto twice #4905

wants to merge 1 commit into from

Conversation

matthieusieben
Copy link

When the loop is run for the first time, we already know that the protoype is not null (because of the if before). We can thus make one fewer evaluation of Object.getPrototypeOf(proto) !== null by performing a do while loop

@jsf-clabot
Copy link

jsf-clabot commented Aug 18, 2020

CLA assistant check
All committers have signed the CLA.

Copy link

@aminya aminya left a comment

Choose a reason for hiding this comment

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

Yes with the preceding check this is true:

  if (Object.getPrototypeOf(value) === null) {
    return true
  }
  let proto = value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue bankruptcy Closing the issue/PR to start fresh
Development

Successfully merging this pull request may close these issues.

None yet

4 participants