Skip to content

Commit 54ec304

Browse files
committed
fixup: comments
Signed-off-by: Todd Baert <[email protected]>
1 parent e68f221 commit 54ec304

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/test/java/dev/openfeature/sdk/benchmark/AllocationBenchmark.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,15 @@
2626
import dev.openfeature.sdk.OpenFeatureAPI;
2727
import dev.openfeature.sdk.Value;
2828

29+
/**
30+
* Runs a large volume of flag evaluations on a VM with 1G memory and GC
31+
* completely disabled so we can take a heap-dump.
32+
*/
2933
public class AllocationBenchmark {
3034

35+
// 10K iterations works well with Xmx1024m (we don't want to run out of memory)
36+
private static final int ITERATIONS = 10000;
37+
3138
@Benchmark
3239
@Warmup(iterations = 0)
3340
@Measurement(iterations = 1)
@@ -44,7 +51,7 @@ public Optional<EvaluationContext> before(HookContext<Object> ctx, Map<String, O
4451
}
4552
});
4653

47-
for (int i = 0; i < 10000; i++) {
54+
for (int i = 0; i < ITERATIONS; i++) {
4855
client.getBooleanValue(BOOLEAN_FLAG_KEY, false);
4956
client.getStringValue(STRING_FLAG_KEY, "default");
5057
client.getIntegerValue(INT_FLAG_KEY, 0);

src/test/java/dev/openfeature/sdk/benchmark/AllocationProfiler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
import org.openjdk.jmh.results.ScalarResult;
1919
import org.openjdk.jmh.util.Utils;
2020

21+
/**
22+
* Takes a heap dump (using JMAP from a separate process) after a benchmark;
23+
* only useful if GC is disabled during the benchmark.
24+
*/
2125
public class AllocationProfiler implements InternalProfiler {
2226

2327
public static class AllocationTotals {

0 commit comments

Comments
 (0)