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
performance problem with instanceof, goog.module, Firefox #2800
Comments
I assume you're doing the performance measurements on a compiled build, so in the module version it's something like
which if I remember correctly gets compiled to
so maybe it's taking longer to lookup the StraightEdge property on the module object? |
Here is the simple-compiled code using instanceof
Here is simple-compiled code using a boolean property
I'm guessing that Firefox does more thorough checking on instanceof prototype chain stuff? In every case on this particular test it is true that What's odd is that this performance change happened when switching to |
That's the goog.module version right? What does the goog.provide version look like? |
Here is the simple-compiled goog.provide version (from commit 5e2f60)
I would think this would be slower than the goog.module version because there are all those property lookups to resolve the namespace names. |
After changing my classes to use goog.module (instead of goog.provide and goog.scope) a performance test was 3 times slower under Firefox browser on MacOS (no change in Chrome and Safari browsers). The run-time of the test jumped from 0.92 seconds to 3.01 seconds.
I tracked the problem down to one particular change, and the culprit is an
instanceof
test in a method called intersectionPossible which is called 15171840 times during this particular test.By changing the test to look for a property instead, the performance is back to where it was before.
I suppose this is a bug with Firefox, but I don't know enough about what changes
goog.module
makes to be able to report it to Firefox/Mozilla.The text was updated successfully, but these errors were encountered: