[morph-user] Morph's use of toString()
Brought to you by:
orangeherbert,
sgarlatm
|
From: Hernan S. <hsi...@pd...> - 2005-06-03 21:25:40
|
I've been doing lots of profiling today and I noticed that my JavaBeans involved
in Morph transformations are getting their toString() methods called.
This happens in MorphUtil.getObjectDescription( Object object ). The else of
the MorphUtils.getObjectDescription() method looks like this:
else {
return
getDelimiter(object) + object +
getDelimiter(object) + " (class " +
object.getClass().getName() + ")";
}
This results in a call to String method:
public static String valueOf(Object obj) {
return (obj == null) ? "null" : obj.toString();
}
...which is where the toString() call on my objects is coming from.
This is a fairly serious performance issue for me, because my toString()
methods are usually not very fast and intended for human eyes (the
java.lang.Object javadoc says "The result should be a concise but informative
representation that is easy for a person to read."). I have use cases that
routinely include Morphing hundreds of objects... times many possible threads,
every bit counts.
Any way to avoid doing the toString() in MorphUtil.getObjectDescription()?
I'm using Morph 0.8.3.
many thanks!
Hernan
|