-
-
Notifications
You must be signed in to change notification settings - Fork 942
Description
Currently, when looking up a Symbol using a ByteList (or a RubyString) we still convert to a Java String and then look up with that as the key. This causes creation of at minimum a wasted Java String plus buffers used by JVM internally for transcoding our bytes into String.
We need to improve the Symbol table to support direct lookup with ByteList.
More justification: Rails and other libraries frequently use the form :"foo#{bar}" to generate symbols on the fly at runtime. With no caching or improvements, this creates two Ruby Strings, two ByteLists, a Java String and transcoding support classes even when the symbol exists, depending on what "bar" is (if it is not a String, there's a third String and ByteList created for it). I we can get this down to one ByteList total for all cases where bar is a String, Symbol, or Fixnum, which would cover the vast majority of cases.