From 8930387693ce46ebd2dc065cbb7a21433909dcc8 Mon Sep 17 00:00:00 2001 From: Dmitry Bushev Date: Thu, 21 Nov 2024 21:42:43 +0300 Subject: [PATCH] Fix runtime-instrument-common benchmark (#11619) --- build.sbt | 8 +-- .../instrument/RuntimeCacheBenchmarks.java | 71 ------------------- 2 files changed, 1 insertion(+), 78 deletions(-) delete mode 100644 engine/runtime-instrument-common/src/bench/java/org/enso/interpreter/instrument/RuntimeCacheBenchmarks.java diff --git a/build.sbt b/build.sbt index 17d5a6e7b4f..808cbd2bfa0 100644 --- a/build.sbt +++ b/build.sbt @@ -3286,21 +3286,15 @@ lazy val `runtime-suggestions` = lazy val `runtime-instrument-common` = (project in file("engine/runtime-instrument-common")) .enablePlugins(JPMSPlugin) - .configs(Benchmark) .settings( frgaalJavaCompilerSetting, scalaModuleDependencySetting, mixedJavaScalaProjectSetting, inConfig(Compile)(truffleRunOptionsSettings), - inConfig(Benchmark)(Defaults.testSettings), instrumentationSettings, Test / javaOptions ++= Seq( "-Dpolyglotimpl.DisableClassPathIsolation=true" ), - bench := (Benchmark / test).tag(Exclusive).value, - Benchmark / parallelExecution := false, - (Benchmark / javaOptions) := - (LocalProject("std-benchmarks") / Compile / javaOptions).value, Test / fork := true, Test / envVars ++= distributionEnvironmentOverrides ++ Map( "ENSO_TEST_DISABLE_IR_CACHE" -> "false" @@ -3338,7 +3332,7 @@ lazy val `runtime-instrument-common` = ) ) .dependsOn(`refactoring-utils`) - .dependsOn(`runtime` % "compile->compile;runtime->runtime;bench->bench") + .dependsOn(`runtime` % "compile->compile;runtime->runtime") lazy val `runtime-instrument-id-execution` = (project in file("engine/runtime-instrument-id-execution")) diff --git a/engine/runtime-instrument-common/src/bench/java/org/enso/interpreter/instrument/RuntimeCacheBenchmarks.java b/engine/runtime-instrument-common/src/bench/java/org/enso/interpreter/instrument/RuntimeCacheBenchmarks.java deleted file mode 100644 index acb186bee35..00000000000 --- a/engine/runtime-instrument-common/src/bench/java/org/enso/interpreter/instrument/RuntimeCacheBenchmarks.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.enso.interpreter.bench.benchmarks; - -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import org.enso.interpreter.instrument.RuntimeCache; -import org.openjdk.jmh.annotations.*; -import org.openjdk.jmh.annotations.AuxCounters.Type; - -@BenchmarkMode(Mode.AverageTime) -@Fork(1) -@Warmup(iterations = 5) -@Measurement(iterations = 5) -@OutputTimeUnit(TimeUnit.MICROSECONDS) -@State(Scope.Benchmark) -public class RuntimeCacheBenchmarks { - - private final RuntimeCache cache = new RuntimeCache(); - private int index = 0; - private UUID[] keys; - - @Param({"1000000"}) - public int items; - - @State(Scope.Thread) - @AuxCounters(Type.EVENTS) - public static class CacheCounters { - - private long hits = 0; - private long misses = 0; - - public double hitRatio() { - return ((double) hits) / (hits + misses); - } - - public void putHit() { - hits++; - } - - public void putMiss() { - misses++; - } - } - - public UUID nextKey() { - if (index == keys.length) { - index = 0; - } - UUID key = keys[index]; - index++; - return key; - } - - @Setup - public void setup() { - keys = new UUID[items]; - for (int i = 0; i < items; i++) { - keys[i] = UUID.randomUUID(); - cache.offer(keys[i], new Object()); - } - } - - @Benchmark - public void benchCacheGet(CacheCounters counters) { - Object result = cache.get(nextKey()); - if (result == null) { - counters.putMiss(); - } else { - counters.putHit(); - } - } -}