mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-27 03:27:56 +01:00
Use setAll for PaletteGetBenchmark
This commit is contained in:
parent
4258e14c5f
commit
83621e2ece
@ -5,6 +5,7 @@ import org.openjdk.jmh.annotations.*;
|
|||||||
import org.openjdk.jmh.infra.Blackhole;
|
import org.openjdk.jmh.infra.Blackhole;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@Warmup(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
|
@Warmup(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
|
||||||
@Measurement(iterations = 10, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
|
@Measurement(iterations = 10, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
|
||||||
@ -22,16 +23,8 @@ public class PaletteGetBenchmark {
|
|||||||
@Setup
|
@Setup
|
||||||
public void setup() {
|
public void setup() {
|
||||||
palette = Palette.newPalette(dimension, 15, 4, 1);
|
palette = Palette.newPalette(dimension, 15, 4, 1);
|
||||||
|
AtomicInteger value = new AtomicInteger();
|
||||||
int value = 0;
|
palette.setAll((x, y, z) -> value.getAndIncrement());
|
||||||
final int dimension = palette.dimension();
|
|
||||||
for (int x = 0; x < dimension; x++) {
|
|
||||||
for (int y = 0; y < dimension; y++) {
|
|
||||||
for (int z = 0; z < dimension; z++) {
|
|
||||||
palette.set(x, y, z, value++);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
|
Loading…
Reference in New Issue
Block a user