Menu

#153 Performance problem

open
nobody
Joda-Time (76)
5
2013-10-17
2012-05-31
cmaulini
No

The following code snippet with Joda-Time 2.1 take more than 10 times longer than with Joda-Time 1.5.2.

final long time = System.currentTimeMillis();
final DateTime dt = new DateTime();
for (int i = 0; i < OPERATION_COUNT; i++) {
dt.plusDays(1);
}
System.out.println("treatment in " + (System.currentTimeMillis() - time) + "ms");

Joda-Time 1.5.2: treatment in 169ms
Joda-Time 2.1: treatment in 2995ms

Is this a regression ?

Discussion

  • Stephen Colebourne

    In Joda-Time 2.x I use volatile fields to ensure thread safety (as required by the memory model). That is probably what you are seeing. The only alternative is breaking backwards compatibility on serialization and more.

     
  • Brian S O'Neill

    Brian S O'Neill - 2013-01-04

    I see a performance regression as well, but not as much. When I remove the volatile modifiers, performance is restored.

     

Log in to post a comment.

MongoDB Logo MongoDB