Review request for JDK-8015668 : overload resolution: performance regression in JDK 7

Jonathan Gibbons jonathan.gibbons at oracle.com
Tue Jun 18 19:02:14 PDT 2013


On 06/18/2013 05:59 PM, David Holmes wrote:
> Hi Vicente,
>
> On 18/06/2013 8:20 PM, Vicente-Arturo Romero-Zaldivar wrote:
>> Hello,
>>
>> Please review this patch. It solves a performance regression in javac
>> for 7u-dev repo.
>>
>> The regression has been detected for a class that declares methods with
>> a lot of parameters (1..254).
>>
>> The proposed solution modifies a data structure used to store wrong
>> method candidates for a given argument / type list. The mentioned data
>> structure was a com.sun.tools.javac.util.List and now is a 
>> java.util.Set.
>
> This seems a little odd semantically looking at some of the code. In 
> particular getName previously used the first/head element in the list:
>
> Symbol sym = candidates.head.sym;
>
> where now you use an arbitrary name from the set:
>
> Symbol sym = candidates.iterator().next().sym;
>
> Is there a reason not to use LinkedList or ArrayList for this so you 
> can use getFirst()?
>
> David
> -----
>

David,

We want to use a Set for perf reasons, but we use a LinkedHashSet to 
address the problem you raise, so the semantics should be unchanged.

-- Jon



>
>> Also a new field has been added to MethodType in
>> com.sun.tools.javac.code.Type this field stores the number of arguments
>> so equal comparison between methods can now be done faster for evident
>> cases.
>>
>> The webrev is here:
>> http://cr.openjdk.java.net/~vromero/8015668_JDK7/webrev.00/
>>
>> The bug report is here:
>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8015668
>>
>> Thanks,
>> Vicente



More information about the compiler-dev mailing list