--
You received this message because you are subscribed to the Google Groups "mozilla-rhino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mozilla-rhin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mozilla-rhino/993847e7-3117-4c6f-b6df-5fbb1928451b%40googlegroups.com.
That's a fun one, and it's used all over Rhino.The code is generated by "idswitch" -- the source is in the "tools" directory.It is used in every native Rhino class that needs to look up a property name from a string, and does so more efficiently than a long sequence of individual string comparisons.The Rhino codebase dates back to the earliest days of Java, and I presume that back then this type of generated code made a meaningful performance difference versus, say, a static hash table. It'd be fun to do some research and see if that's still the case.
On Thu, Jul 25, 2019 at 10:57 AM Juan Manuel <jmflo...@gmail.com> wrote:
I am using Rhino for a research project, and I need to understand certain parts of the system.--I came across the switch statement in https://github.com/mozilla/rhino/blob/master/src/org/mozilla/javascript/TokenStream.java#L167 and I am very curious about it. I have two questions:
- It seems to be generated code but I can't seem to find how it is generated. Where is the logic that generates this code?
- What is the rationale for using this switch instead of simply using a set with the keywords, for example?
Thank you.
You received this message because you are subscribed to the Google Groups "mozilla-rhino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mozill...@googlegroups.com.