Use of long in Nashorn

Hannes Wallnoefer hannes.wallnoefer at oracle.com
Mon Dec 14 16:30:01 UTC 2015


For the record, I tried the integer index optimization for array 
iterators, but didn't really see a difference running a microbenchmark 
using Array.prototype.forEach, so I left it out after all.

Hannes

Am 2015-12-11 um 16:30 schrieb Hannes Wallnoefer:
> Am 2015-12-11 um 16:21 schrieb Attila Szegedi:
>> On Dec 11, 2015, at 4:08 PM, Hannes Wallnoefer 
>> <hannes.wallnoefer at oracle.com> wrote:
>>
>>> I didn't implement the int/double overloading of array iterator 
>>> actions. Unless I missed something, I would have to implement two 
>>> forEach methods in each subclass, which seem ugly and error prone.
>> You haven’t missed anything; that’s exactly how that would work. 
>> Ultimately, if we had macros in Java, this wouldn’t need to look 
>> ugly, but we don’t have them, so… Performance optimizations are 
>> sometimes ugly :-) Anyway, this needn’t happen now, although 
>> ultimately I don’t think it’d be much of a big deal to implement, 
>> even with the unfortunate code duplication, and we still wouldn’t 
>> always force-promote the parameter type for the callback functions to 
>> double.
>>
>
> Ok, you convinced me. I'll add that optimization an upcoming webrev. 
> Still waiting for other reviews though.
>
> Hannes



More information about the nashorn-dev mailing list