Slow convert to Java object

Maxim Milovanov <milov...@...>


I am trying write select-query and my perfomance is very slow when I call method toList().
How I can improve this perfomace ?

My example:

        long start;

        long end;

        try (GraphTraversalSource g = graph.traversal()) {

            start = System.currentTimeMillis();

            GraphTraversal<Vertex, Vertex> list2 = g.V().hasLabel("Entity");

            end = System.currentTimeMillis();

            System.out.printf("getGremlinTime: %d ms\n", (end - start));

            start = end;

            List<Vertex> res2 = list2.toList();

            end = System.currentTimeMillis();

            System.out.printf("toList: %d ms\n gremlin count: %d\n", (end - start), res2.size());


Debug log:

getGremlinTime: 13 ms
2020-12-31 14:19:01.336  WARN 14144 --- [           main] o.j.g.transaction.StandardJanusGraphTx   : Query requires iterating over all vertices [(~label = Entity)]. For better performance, use indexes
toList: 12025 ms
 gremlin count: 105  

Join { to automatically receive all group messages.