My favorites | Sign in
jau
Project Home Downloads Wiki Issues Source
Search
for
Performance  
Performance of the library.
Updated Apr 14, 2009 by tim.lebe...@gmail.com

Introduction

Currently the library uses Java reflection API. That's why the current implementation is slower than implementing e.g. equals() manually. On the other hand the performance difference may be acceptable in particular cases. Additionally, nothing in the JAU API prevents an implementation using code generation or other techniques.

Details

Performance reports:

equals() for RealClass:

equals() for a class with one String field (different string lengths):

equals() for classes with different number of int fields:

hashCode() for RealClass:

toString() for RealClass:

Conclusions

  • for "small" field types (byte, int, float) performance of equals()/hashCode() implemented with JAU depends heavily on the number of fields and is much worse than in manually implemented methods
  • for an object with one String field the value of the field must be of length 500 of higher for JAU overhead to become neglectable
  • toString() performance of JAU is really good even for classes with many small fields

Sign in to add a comment
Powered by Google Project Hosting