I have found some good articles about optimizing queries on Gremlin, but I still don't know how to get the memory consumption and time of execution of a query.
Some places that I found talking about query optimization: https://github.com/tinkerpop/gremlin/wiki/Traversal-Optimization https://academy.datastax.com/content/dse-gremlin-queries-good-better-best https://medium.com/@jayanta.mondal/analyzing-and-improving-the-performance-azure-cosmos-db-gremlin-queries-7f68bbbac2c