commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Nokleberg <>
Subject Re: [BeanUtils] Interesting Microbenchmarks
Date Mon, 06 Oct 2003 03:31:37 GMT
I finally got around to adding a dedicated BeanCopier class to CGLIB.
The API looks something like:

  BeanCopier copier = BeanCopier.create(bean1.getClass(), bean2.getClass());
  copier.copy(bean1, bean2);

The copiers are cached, but if you can reuse the very same instance you get
much faster times, so I've benchmarked both ways. This is for 100000
iterations on JDK 1.4.2_01 (Linux).

  CGLIB? Reuse copier? Duration
  ------ ------------- --------
  No     N/A           4,110 ms    <-- PU.copyProperties(bean,bean)
  Yes    No               87 ms
  Yes    Yes               5 ms

The results were better than I expected :-) The generated code is very
simple which I think lets HotSpot really go to town.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message