On Thu, Apr 16, 2009 at 10:46 AM, Ian Bambury <[email protected]> wrote:

> 2009/4/16 Vitali Lovich <[email protected]>
>
>>
>> You seem to be saying that:
>>
>> tree t = new tree()
>> t.addItem("abc");
>> t.addItem("def");
>> RootPanel.get().add(t);
>>
>> will have fewer reflows than
>>
>> tree t = new tree()
>> RootPanel.get().add(t)
>> t.addItem("abc")
>> t.addItem("def")
>>
>> According to you (at least from what you've said so far) is that the 1st
>> snippet will cause 1 DOM reflow whereas the below snippet will cause 2,
>> which isn't actually the case AFAIK.  Both will only cause 1 & will be
>> equally fast.
>>
>
> I think you are both right, depending on the browser you are in.
>
> FF2 (IIRC) will rerender during a sequence where most other browsers won't.
> I don't know when it decides to do that, but most other browsers would be
> still displaying your splash screen while FF2 has hidden it and has stuff
> dancing about on the screen.
>
No, even FF2 should display the same behaviour.  There's only two ways (at
least that I can see) that the browser could reflow DOM changes as they are
being performed within Javascript.

1)  Have a secondary thread performing the rendering.  This might actually
be a performance improvement that browser vendors could look at, but it
makes it really difficult because then you have to introduce synchronization
particularly since rendering can actually change the DOM AFAIK.  But even if
it couldn't there would be other thread-safety related issues.  No browser
AFAIK actually does this.

2)  Perform reflows as the underlying DOM is manipulated via JS.   This
would be bad from a performance perspective (we want to minimize reflows
which would not be possible if we couldn't merge multiple DOM manipulations
into 1 reflow being triggered).  It may also be difficult from an
architectural perspective depending on how JS manipulations of the DOM are
implemented (it probably bypasses a lot of code & manipulates the raw data
structures).

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to