Delete operation is 50 x slower than insert?

Hi community,

I have created the following dummy function for testing the performance of insert/delete operations:

try {
var start = Date.now();

db.begin();
for (var i=0;i<20000;i++) {

    var testVertex = api.newVertex("TEST");
        testVertex.save();

}
  var millis = Date.now() - start;

  start = Date.now();
  db.commit();

  millis = Date.now() - start;
  print("Creation Done. - time elapsed:" + millis + " ms");

  start = Date.now();
  db.command("DELETE VERTEX FROM TEST");
   millis = Date.now() - start;

  print("Deletion Done. - time elapsed:" + millis + " ms");
} catch (e) {
 db.rollback();
  print("ERROR:"+e);
}

The result on our test machines (16gb ram, 8 core) is as follows:

 Creation Done. - time elapsed:702 ms
 Deletion Done. - time elapsed:35756 ms

The creation of the vertices seems to be OK but the deletion speed is way too slow. :scream:

Is this expected behaviour? What can I do to improve the speed.

Thanks
Jon

What version do you use ?
I used latest develop version and have got following numbers:
Creation time 1,350,704 ms., deletion time 1,251,092 ms. Code which I used is there https://gist.github.com/laa/192ac6651ece3aad05c134b345780f84

I’am using 3.0.23.

From your high numbers I assume you mean microsecs right ? Why is your deletion so fast? Even if I am doing the deletion in Studio it seems quite slow so I assume it has nothing to do with the fact that I am doing the task in embedded javascript.