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

nameInThis() in oop.js is slow #177

Closed
ajklein opened this issue Jun 7, 2013 · 1 comment
Closed

nameInThis() in oop.js is slow #177

ajklein opened this issue Jun 7, 2013 · 1 comment

Comments

@ajklein
Copy link
Contributor

ajklein commented Jun 7, 2013

The code is reproduced below:

function nameInThis(inValue) {
  for (var n in this) {
    var d = getPropertyDescriptor(this, n);
    if (d.value == inValue) {
      return n;
    }
  }
}

When this hits an HTML element, it ends up walking through all kinds of problematic properties, like offsetTop and isContentEditable, which then show up very hot on a profile.

@sjmiles
Copy link
Contributor

sjmiles commented Jun 12, 2013

As of 2d5f89b, prototypes registered via Polymer are name hinted so they will never call nameInThis.

Also, fwiw, nameInThis was optimized in 26e8b14, even though only edge cases that should ever get there.

@sorvell sorvell closed this as completed Jun 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants