Return the result of the list.recycle() call (#9264)

Motivation:

Resolve the issue highlighted by SpotJMHBugs that the creation of the RecyclableArrayList may be elided by the JIT since the result isn't consumed or returned.

Modifications:

Return the result of `list.recycle()` so that the list isn't elided.

Result:

The JMH benchmark shows a change in performance indicating that the prior results of this may be unsound.
This commit is contained in:
Alex Blewitt 2019-06-22 06:21:51 +01:00 committed by Norman Maurer
parent c61fa9be70
commit 99034a15b5

View File

@ -36,8 +36,8 @@ public class RecyclableArrayListBenchmark extends AbstractMicrobenchmark {
public int size;
@Benchmark
public void recycleSameThread() {
public boolean recycleSameThread() {
RecyclableArrayList list = RecyclableArrayList.newInstance(size);
list.recycle();
return list.recycle();
}
}