orientdb
                                
                                 orientdb copied to clipboard
                                
                                    orientdb copied to clipboard
                            
                            
                            
                        Very slow updating of data compared with creating
OrientDB Version: 3.1.7
Java Version: 15
OS: Windows
Expected behavior
Updating records that do not change the size of the record should take a similar amount of time as creating them
Actual behavior
Updating is between 4 and 18 times slower
Steps to reproduce
String testClass = "TestUpdate2";
final OSchema schema = db.getMetadata().getSchema();
if (!schema.existsClass(testClass)) {
        db.createClass(testClass);
}
System.out.println("Creating...");
long begin = System.currentTimeMillis();
for (int i = 0; i < 1_000_000; i++) {
        final OElement doc = db.newInstance(testClass);
        doc.setProperty("Int", 0);
        doc.save();
}
long diff = System.currentTimeMillis() - begin;
System.out.println("time " + DurationFormatUtils.formatDurationHMS(diff));
System.out.println("Updating...");
final OResultSet results = db.query("select from TestUpdate limit -1");
begin = System.currentTimeMillis();
while (results.hasNext()) {
          final OElement doc = results.next().toElement();
          doc.setProperty("Int", 1);
          doc.save();
}
results.close();
long diff = System.currentTimeMillis() - begin;
System.out.println("time " + DurationFormatUtils.formatDurationHMS(diff));
Running VisualVM shows that it spends 50% of the time on the update doing a method called OClusterPage.doDefragementation(), however the actual record size has not changed so it seems a bit strange that it would have to deal with the possibility of fragmentation.
@laa any news on this?