On Wed, 30 May 2007 17:20:40 +0200, ddailey <[EMAIL PROTECTED]>
wrote:
> I believe I have seen this question asked and answered here before, I
> may even have asked it (though I sincerely doubt that I ever answered
> it).
>
> So apologies in advance for retracing any overly familiar ground.
>
> Is there some way to tell when a complex page has actually finished
> drawing?
Apart from looking at the user agent, no. You may get an indication based
on the level of CPU usage, or other such metrics, but nothing exact.
There's no event sent when rendering is "finished", because defining what
that means is probably not so easy. The same problem I guess can be "Can
you tell when a complex HTML page has actually finished drawing?".
> I am trying to do some timing to see how much time various things take
> in the SVG DOM. If I add, for example, 3000 text nodes
> using code like:
>
> try{suspendHandle = Root.suspendRedraw(1000000000000);}
> catch(e){}
> D0=(new Date()).valueOf()
> for (i=0;i<3000;i++)addNode("text")
> try{Root.unsuspendRedraw(suspendHandle);}
> catch(e){}
> D1=new Date().valueOf()
> display(D1)
>
> I find that the second date object D1 is calculated and displayed before
> the text actually finishes drawing on the screen.
That's the expected behaviour. unsuspendRedraw just tells the UA that it
may draw the image again, not that it has to do it right away. There's a
forceRedraw method that can be used, but the 1.1 spec isn't that clear
about if that does anything if suspendRedraw was called first. It probably
should force a redraw though.
And if forceRedraw is not implemented as a synchronous operation then you
are screwed anyway.
> Is there another event that fires when all the rendering is complete?
No, and also note that it may be difficult to say when it's complete. Some
scripts constantly modify the document. There's no way to say "it's done"
in such cases.
Hope I didn't discourage you too much. suspend/unsuspendRedraw are meant
as ways to optimize the content because the user agent can skip doing
unnecessary partial redraws. I don't think it was designed to help much
with doing performance measurements/benchmarking.
One way to get some measurements would be to add an element that requires
user interaction. Then as you unsuspendRedraw, take one timevalue, and
when all drawing is complete you can probably count on that this last
element is clickable, so require the user to click it and take another
timevalue. The difference between those should be a sample of the
rendering time. Repeat and make an average.
Regards
/Erik
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/