Package com.google.javascript.rhino
Class RhinoStringPool
java.lang.Object
com.google.javascript.rhino.RhinoStringPool
An interning pool for strings used by the Rhino package.
As of 2021-03-16 and again as of 2024-12-09, this custom pool is measurably more performant than `String::intern`.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
A list of strings that is lazily interned into a RhinoStringPool as they are accessed. -
Method Summary
-
Method Details
-
uncheckedEquals
Check if two strings are the same according to interning.The caller is responsible for ensuring that strings passed to this method are actually interned. This method mainly exists to highlight where equality checks depend on interning for correctness.
Ideally we could use something like a branded-type, for interned strings, to verify correct usage. However, Java doesn't support type-brands, and using like wrapper objects would undermine performance. This also needs to be ergonomic enough that callers don't resort to using `==` directly.
-
addOrGet
-