On Fri, 12 May 2023 13:19:44 GMT, Chen Liang <li...@openjdk.org> wrote:

>> Adam Sotona has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   fixed jmh benchmark parameters
>
> test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java line 57:
> 
>> 55:     public void setup() throws IOException {
>> 56:         shared = new LinkedList<>();
>> 57:         unshared = new LinkedList<>();
> 
> LinkedList should be replaced by ArrayList, as:
> 1. LinkedList's node wrapper around each object is too heavy, ArrayList has 
> smaller wrapper
> 2. LinkedList iteration needs to follow links while ArrayList access can be 
> machine optimized
> 3. ArrayList addition is amortized O(1), not really worse than LinkedList 
> additions.

Construction size is irrelevant here as each node holds the whole expanded 
`ClassModel` instances.
`LinkedList` iterator `next` speed is O(1) and possible `AraryList` 
optimisations of the test data iterator have no effect on this benchmark. 
Construction speed of `ArrayList` is not O(1) when the `grow` method is called, 
however it is also irrelevant as this is unmeasured setup part of the benchmark.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13671#discussion_r1193614917

Reply via email to