@robertdale @spmallette 

The JMH is a microbenchmark that the OpenJDK uses to performance improvement 
that is trustful.
The issue was a compiler trick that I did a mistake.
The code below will show the same result on both metrics:


```java
@Warmup(iterations = 5, time = 1)
@Measurement(iterations = 20, time = 1)
@Fork(3)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Thread)
public class ClientBenchmark {


    private ObjectMapper mapper = 
GraphSONMapper.build().version(GraphSONVersion.V3_0).create().createMapper();
    private Graph graph = TinkerFactory.createModern();
    private Vertex vertex = graph.traversal().V().next();

    @Setup
    public void setup() {
        this.mapper = 
GraphSONMapper.build().version(GraphSONVersion.V3_0).create().createMapper();
        this.graph = TinkerFactory.createModern();
        this.vertex = graph.traversal().V().next();
    }

    @Benchmark
    public String write(Blackhole blackhole) throws JsonProcessingException {
        String value = mapper.writeValueAsString(vertex);
        blackhole.consume(value);
        return value;
    }

}

```



[ Full content available at: https://github.com/apache/tinkerpop/pull/1001 ]
This message was relayed via gitbox.apache.org for dev@tinkerpop.apache.org

Reply via email to