Re: [morph-user] Morph's use of toString()
Brought to you by:
orangeherbert,
sgarlatm
|
From: Hernan S. <hsi...@pd...> - 2005-06-06 18:04:29
|
In looking through the code, it does appear that the logging configuration is
incorrect in my code, causing this call to toString(). Thanks for your previous
message, it pointed me in the right direction and sorry for the list noise.
Hernan
On Mon, 6 Jun 2005, Hernan Silberman wrote:
>
> Here's a stack trace. com.dw.nile.dom.SequenceDO is my source JavaBean that I'm
> transforming with this call (myGraphTransformer is a
> net.sf.morph.transform.transformers.DelegatingTransformer):
>
> myGraphTransformer.
> convert( SequenceDescriptor.class,
> theCurrSeq )
>
> at com.dw.nile.dom.SequenceDO.toString(SequenceDO.java:288)
> at java.lang.String.valueOf(String.java:2577)
> at java.lang.StringBuffer.append(StringBuffer.java:220)
> at net.sf.morph.util.MorphUtils.getObjectDescription(MorphUtils.java:310)
> at net.sf.morph.transform.transformers.BaseTransformer.convert(BaseTransformer.java:204)
> at net.sf.morph.transform.transformers.DelegatingTransformer.convertImpl(DelegatingTransformer.java:180)
> at net.sf.morph.transform.transformers.BaseTransformer.convert(BaseTransformer.java:225)
> at net.sf.morph.transform.transformers.BaseTransformer.convert(BaseTransformer.java:237)
>
> thanks Matt, let me know if you need more information or if you see something
> I'm doing wrong.
>
> Hernan
>
>
> On Mon, 6 Jun 2005, Matt Sgarlata wrote:
>
> > Hi Hernan,
> >
> > When is MorphUtil.getObjectDescription called? I think my intention was
> > for it to only be called when writing TRACE output to the log file. As
> > you point out, calling this method is incredibly expensive so in a
> > production system it should definitely not be called.
> >
> > Matt
> >
> > Hernan Silberman wrote:
> >
> > >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
> > >
> > >
> > >
> > >-------------------------------------------------------
> > >This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
> > >a projector? How fast can you ride your desk chair down the office luge track?
> > >If you want to score the big prize, get to know the little guy.
> > >Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
> > >_______________________________________________
> > >morph-user mailing list
> > >mor...@li...
> > >https://lists.sourceforge.net/lists/listinfo/morph-user
> > >
> > >
> > >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput
> > a projector? How fast can you ride your desk chair down the office luge track?
> > If you want to score the big prize, get to know the little guy.
> > Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
> > _______________________________________________
> > morph-user mailing list
> > mor...@li...
> > https://lists.sourceforge.net/lists/listinfo/morph-user
> >
>
>
--
Hernan Silberman
PDI/Dreamworks
ext.29162 / 650-562-9162 / cell 415-810-5809
text pager: pag...@an...
|