Adding packages to modules
Peter Levart
peter.levart at gmail.com
Thu Apr 28 20:53:36 UTC 2016
On 04/28/2016 04:45 PM, Alan Bateman wrote:
> On 28/04/2016 14:45, Peter Levart wrote:
>> Hi Alan,
>>
>> I also have a little optimization for Module.extraPackages:
>>
>> http://cr.openjdk.java.net/~plevart/jdk9-dev/Module.extraPackages/webrev.01/
>>
>>
>> This is only used from java.lang.reflect.Proxy presently, so what is
>> currently there is not performance critical, but if it gets used
>> more, then the provided patch gives smaller footprint and O(n)
>> instead of O(n^2) time to add n packages to a module + doesn't
>> produce so much garbage.
>>
>> What do you think?
> No objection to changing this from copy-on-write to a CHM. The
> original implementation was to keep it simple and to special-case the
> one package case. It hasn't been a performance issue so far but if we
> have a lot of Proxy classes generated into the same module then it has
> potential.
>
> Your patch reminds me that we should probably change
> JVM_AddModulePackage to make it idempotent as dropping the
> computeIfAbsent here would make this more readable.
>
> I see you've changed to toArray in getPackages to use the size and
> curious if that helps (just thinking of Aleksey essay on this topic [1]).
>
> -Alan
>
> [1] http://shipilev.net/blog/2016/arrays-wisdom-ancients/
...I did that automatically. Reading Aleksey essay now I see there's no
point in doing that. For ArrayList case it even has a negative impact.
We learn something every day.
Regards, Peter
More information about the jigsaw-dev
mailing list