Tim has posted 4 posts at DZone. View Full User Profile

JAU (Java Annotation Based Utilities) 1.0

05.06.2009
| 2664 views |
  • submit to reddit

JAU 1.0 is ready for download from the project site: http://code.google.com/p/jau/.

The library will help you to implement common methods like .equals() or .hashCode() using annotations.

 

As promised in my last post, I did some performance analysis and here are results for toString() on this "real life" class (lower bar is better). The full performance report is here.

JAU toString() performance on a

As expected, manually implemented methods are faster than JAU (which uses reflection).

  • 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 or higher for JAU overhead to become neglectable
  • toString() performance of JAU is really good even for classes with many small fields
0
Published at DZone with permission of its author, Tim Lebedkov.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)