Review request for JDK-8006766: Array-like access to characters of	a string is slow
    Hannes Wallnoefer 
    hannes.wallnoefer at oracle.com
       
    Thu Jan 24 06:35:37 PST 2013
    
    
  
Please review JDK-8006766 (Array-like access to characters of a string 
is slow) at
http://cr.openjdk.java.net/~hannesw/8006766/
This overrides ScriptObject.findGetIndexMethod() in NativeString to 
avoid creating a NativeString wrapper for array-like access to the 
characters of a string (e.g. "foo"[0]). Performance gain as measured by 
test/examples/string-micro.js is about 3x.
The larger part of this patch involves changing the signature of 
ScriptObject.lookup() and related methods to take the LinkRequest object 
as second parameter.
This is necessary to make sure we're actually dealing with a primitive 
JS string vs. a wrapped String object in 
NativeString.findGetIndexMethod(). It also helped rewrite my patch for 
JDK-8006570 (this-value for non-strict functions should be converted to 
object) in a much nicer way, doing it locally in 
ScriptFunction.findCallMethod() rather than centrally in 
NashornLinker.getGuardedInvocation().
Hannes
    
    
More information about the nashorn-dev
mailing list