This would be great, and here's the good news:


http://www.objectweb.org/wws/arc/architecture/2003-10/msg00048.html



Chris Nokleberg wrote:
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.

Chris



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to