You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "otaviojava (GitHub)" <gi...@apache.org> on 2018/12/03 22:29:07 UTC

[GitHub] [tinkerpop] otaviojava commented on issue #1001: uses the directly field instead of getter method

Hey everyone. 
First, sorry by delay, I did a test with this code below:

```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 final ObjectMapper mapper = GraphSONMapper.build().version(GraphSONVersion.V3_0).create().createMapper();
    private final Graph graph = TinkerFactory.createModern();
    private final Vertex vertex = graph.traversal().V().next();

    @Setup
    public void setup() {
    }

    @Benchmark
    public String write() throws JsonProcessingException {
        return mapper.writeValueAsString(vertex);
    }
}
```


As you can see I seted the **Throughput** that Measures the number of operations per second, meaning the number of times per second your benchmark method could be executed. Thereby, higher is better.

To set the dependency, I just changed the core version to do this test:

```xml
<dependency>
     <groupId>org.apache.tinkerpop</groupId>
     <artifactId>gremlin-core</artifactId>
     <version>3.3.4</version>
     <!--version>3.4.0-SNAPSHOT</version-->
 </dependency>
```

## The result

Changed code: 

Benchmark               Mode  Cnt    Score
ClientBenchmark.write  thrpt   60  598,397


Current code:

Benchmark               Mode  Cnt    Score
ClientBenchmark.write  thrpt   60  580,662

As you can see the changed code is faster around 10%.

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