MCPcopy Index your code
hub / github.com/grpc/grpc-java / ContextState

Class ContextState

api/src/jmh/java/io/grpc/WriteBenchmark.java:32–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30/** Write benchmark. */
31public class WriteBenchmark {
32 @State(Scope.Thread)
33 public static class ContextState {
34 @Param({"0", "10", "25", "100"})
35 public int preexistingKeys;
36
37 Context.Key<Object> key1 = Context.key("key1");
38 Context.Key<Object> key2 = Context.key("key2");
39 Context.Key<Object> key3 = Context.key("key3");
40 Context.Key<Object> key4 = Context.key("key4");
41 Context context;
42 Object val = new Object();
43
44 @Setup
45 public void setup() {
46 context = Context.ROOT;
47 for (int i = 0; i < preexistingKeys; i++) {
48 context = context.withValue(Context.key("preexisting_key" + i), val);
49 }
50 }
51 }
52
53 /** Perform the write operation. */
54 @Benchmark

Callers

nothing calls this directly

Calls 1

keyMethod · 0.95

Tested by

no test coverage detected