@Setup public void setup(BitmapIterationBenchmark state) { bitmap = state.makeBitmap(state.prob); } }
@State(Scope.Benchmark) public static class IterState { private ImmutableBitmap bitmap; @Setup public void setup(BitmapIterationBenchmark state) { bitmap = state.makeBitmap(state.prob); } }
@Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MICROSECONDS) @Fork(1) public double measureCostStrategySingle() { double totalCost = 0; for (DataSegment s : segments) { totalCost += CostBalancerStrategy.computeJointSegmentsCost(segment, s); } return totalCost; }
/** * @author <a href="mailto:julien@julienviet.com">Julien Viet</a> */ @Warmup(iterations = 20, time = 1, timeUnit = TimeUnit.SECONDS) @Measurement(iterations = 10, time = 2, timeUnit = TimeUnit.SECONDS) @Threads(1) @BenchmarkMode(Mode.Throughput) @Fork(value = 1, jvmArgs = { "-XX:+UseBiasedLocking", "-XX:BiasedLockingStartupDelay=0", "-XX:+AggressiveOpts", "-Djmh.executor=CUSTOM", "-Djmh.executor.class=io.vertx.core.impl.VertxExecutorService" }) @OutputTimeUnit(TimeUnit.MILLISECONDS) public abstract class BenchmarkBase { }
@Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MICROSECONDS) public void matchLikeEquals(Blackhole blackhole) { final ImmutableBitmap bitmapIndex = LIKE_EQUALS.getBitmapIndex(selector); blackhole.consume(bitmapIndex); }
@Benchmark public long computePositionWithMask() { return (int) hashcode & (hashTableSize - 1); }
@SuppressWarnings("PublicField") @AuxCounters @State(Scope.Thread) public static class CompressionCounter { public long inputSize; public long outputSize; }
@Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MICROSECONDS) public void longRead(Blackhole blackhole) { StorageAdapter sa = new QueryableIndexStorageAdapter(qIndex); Sequence<Cursor> cursors = makeCursors(sa, null); readCursorsLong(cursors, blackhole); }
@Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MICROSECONDS) @Fork(1) public double measureIntervalPenalty() { return CostBalancerStrategy.intervalCost(x1, y0, y1); } }
@State(Scope.Thread) public static class BaselineState { Vertx vertx; BenchmarkContext context; Handler<Void> task; @Setup public void setup() { vertx = Vertx.vertx(); context = BenchmarkContext.create(vertx); task = v -> consume("the-string"); } }
@Benchmark public long computePositionWithMod() { return (int) (hashcode & 0x7fff_ffff_ffff_ffffL) % hashTableSize; }
@Setup public void setup() { pages = createBigintPages(POSITIONS, groupCount, channelCount, hashEnabled); }
@Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MICROSECONDS) public void timeFilterHalf(Blackhole blackhole) { StorageAdapter sa = new QueryableIndexStorageAdapter(qIndex); Sequence<Cursor> cursors = makeCursors(sa, timeFilterHalf); readCursorsLong(cursors, blackhole); }
@State(Scope.Thread) public static class BenchmarkData { private Slice complexGeometry; private Slice simpleGeometry; @Setup public void setup() throws IOException { complexGeometry = GeoFunctions.stGeometryFromText(Slices.utf8Slice(loadPolygon("large_polygon.txt"))); simpleGeometry = GeoFunctions.stGeometryFromText(Slices.utf8Slice("POLYGON ((1 1, 4 1, 1 4))")); } }
@Benchmark public int runBenchmark(BenchmarkData data) { PageSorter pageSorter = new PagesIndexPageSorter(new PagesIndex.TestingFactory(false)); long[] addresses = pageSorter.sort(data.types, data.pages, data.sortChannels, nCopies(data.sortChannels.size(), ASC_NULLS_FIRST), 10_000); return addresses.length; }
@Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MICROSECONDS) public void uncompressed(Blackhole blackhole) { final ImmutableConciseSet set = ImmutableConciseSet.complement(null, emptyRows); blackhole.consume(set); assert (emptyRows == set.size()); } }
@State(Scope.Thread) public static class BenchmarkData { private Slice complexGeometry; private Slice simpleGeometry; @Setup public void setup() throws IOException { complexGeometry = stGeometryFromText(utf8Slice(loadPolygon("large_polygon.txt"))); simpleGeometry = stGeometryFromText(utf8Slice("POLYGON ((1 1, 4 1, 1 4))")); } }