Only if you use the debug bar. Currently the showed size is misleading IMO.
On Tue, Nov 13, 2012 at 5:04 PM, Ernesto Reinaldo Barreiro < [email protected]> wrote: > Wouldn't this make complex pages (e.g. with lots of LDMs) much more slow? > > On Tue, Nov 13, 2012 at 3:58 PM, Martin Grigorov <[email protected] > >wrote: > > > Hi, > > > > The debug panel in wicket-devutils uses WicketObjects#sizeOf() to > calculate > > the size of the page and the session. > > > > The "problem" that I see is that it calculates the size of the > non-detached > > object. I think what really matters is the size after detaching it, > because > > this is what is being saved in the http session and the disk, and I guess > > this is what the developer needs to know actually. > > > > Since #detach() can be called at any time, and several times per request > > processing I suggest the following change: > > > > --- > > > > > a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/WicketObjects.java > > +++ > > > > > b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/WicketObjects.java > > @@ -31,6 +31,7 @@ import org.apache.wicket.Application; > > import org.apache.wicket.Component; > > import org.apache.wicket.WicketRuntimeException; > > import org.apache.wicket.application.IClassResolver; > > +import org.apache.wicket.model.IDetachable; > > import org.apache.wicket.serialize.ISerializer; > > import org.apache.wicket.serialize.java.JavaSerializer; > > import org.apache.wicket.settings.IApplicationSettings; > > @@ -416,6 +417,15 @@ public class WicketObjects > > */ > > public static long sizeof(final Serializable object) > > { > > + if (object instanceof Component) > > + { > > + ((Component) object).detach(); > > + } > > + else if (object instanceof IDetachable) > > + { > > + ((IDetachable) object).detach(); > > + } > > + > > return objectSizeOfStrategy.sizeOf(object); > > } > > > > > > Do you see any problems with this ? > > > > -- > > Martin Grigorov > > jWeekend > > Training, Consulting, Development > > http://jWeekend.com <http://jweekend.com/> > > > > > > -- > Regards - Ernesto Reinaldo Barreiro > Antilia Soft > http://antiliasoft.com/ <http://antiliasoft.com/antilia> > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/>
