-
Notifications
You must be signed in to change notification settings - Fork 848
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
use java string switch for findPrototypeId #848
Conversation
Thanks! |
There is no notable performance change for Test262SuiteTest. |
I benchmarked
|
|
As I recall that's all historical stuff and probably makes no sense for
backward compatibility. I'm having a super-busy week but I hope to be able
to think clearly about all this stuff soon.
Here's one question: Do we think that string switch in Java is implemented
any more efficiently than a series of if/then statements? If not then this
would at least be a theoretical performance regression.
In the past I've also tried to see if there are "perfect hashing" libraries
for Java that would be a cleaner way to solve this problem but I never
found one that was really usable -- but that's exactly what we're trying to
do here.
…On Wed, Mar 24, 2021 at 8:20 AM tuchida ***@***.***> wrote:
NativeMath#findPrototypeId seems to have slowed down.
https://github.com/mozilla/rhino/blob/58f7c7c7f3cbc0228055b27e5c45348dca4e8854/src/org/mozilla/javascript/NativeMath.java#L465
Math.PI, etc. are static properties, so it looks like they should be
initialized with fillConstructorProperties, but why is the code written
in such a way that it is set to prototype?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#848 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD7I2ZXZA47YDTFQZK7W3TTFH7KTANCNFSM4ZRL75WQ>
.
|
It seems to make a This is a
|
Have applied this patch to the rhino fork used by HtmlUnit. The test suite does not show any notable changes regarding performance. Still like to see this merged because the code is much cleaner and maybe we will benefit from JDK optimizations in the future. |
Will you continue to use this? |
Yes, I agree that we should make this change, although it is just short of it's 20th birthday ;-) I see that @rbri did this by changing the "idswitch" tool. I think this is actually a good idea as it automated the conversion. We can leave it in for now -- over time as people want to just do things manually they can leave out the special "#string_id_map#" comments. We should, however, update the README for "idswitch" to indicate that it's just generating a string switch and is probably not useful once this migration is complete. |
So given that we used the tool, I'm going to merge it now and we can do additional stuff later. |
Have updated SwitchGenerator and regenerate all classes based on @tuchida idea (#847)