From: David Mark on
Jorge wrote:
> On Jan 13, 10:52 am, Hans-Georg Michna <hans-
> georgNoEmailPle...(a)michna.com> wrote:
>> On Wed, 13 Jan 2010 03:46:42 -0500, David Mark wrote:
>>> Hans-Georg Michna wrote:
>>>> Most browsers don't even render to screen, as long as any
>>>> JavaScript task is running, with the exception of Opera.
>>> That's incorrect. They virtually all re-flow on exiting an execution
>>> context. Though it makes no difference for this "problem" (can't stress
>>> that enough), it is very useful to know this.
>>> So if you see code that sets multiple styles and it calls a function to
>>> set a single style in a loop (sound familiar?), you can figure on at
>>> least one and maybe n re-flows during that loop. I see these patterns
>>> all the time and adjusting them out usually leads to huge performance
>>> increases (with very little effort invested), particularly for large and
>>> complex DOM's (the norm, of course).
>> You are saying that most browsers re-render to screen while some
>> JavaScript code is still to be or being executed? I haven't seen
>> that. What I see is that the browsers, except perhaps Opera,
>> don't do anything at all on screen until the JavaScript code
>> finishes execution or is killed because it ran for too long.
>>
>> But I haven't done any exhausting tests on this. Has anybody
>> else here tested this thoroughly?
>
> A reflow is not a redraw. There's (usually) many (more) reflows per
> redraw. Reflows happen during normal JS execution,

For seemingly the millionth time, re-flows happen on exiting execution
contexts (in virtually every known graphical browser).

but redraws
> (exception: Opera) don't.

You are out of your tiny little mind. :)
From: Jorge on
On Jan 13, 11:08 am, David Mark <dmark.cins...(a)gmail.com> wrote:
> (...)
> For seemingly the millionth time, re-flows happen on exiting execution
> contexts (in virtually every known graphical browser).

No. Reflows happen as needed. E.g. simply reading an .offsetWidth can
trigger a reflow.
--
Jorge.
From: Jorge on
On Jan 13, 11:15 am, Jorge <jo...(a)jorgechamorro.com> wrote:
>
> No. Reflows happen as needed. E.g. simply reading an .offsetWidth can
> trigger a reflow.

And 5 lines later, in the very same piece of code, reading it again
might trigger yet another reflow.
--
Jorge.
From: David Mark on
Jorge wrote:
> On Jan 13, 11:15 am, Jorge <jo...(a)jorgechamorro.com> wrote:
>> No. Reflows happen as needed. E.g. simply reading an .offsetWidth can
>> trigger a reflow.
>
> And 5 lines later, in the very same piece of code, reading it again
> might trigger yet another reflow.

Another _recalculation_ of the offsetWidth, but only if something
changed in between. So what?
From: Jorge on
On Jan 13, 11:33 am, David Mark <dmark.cins...(a)gmail.com> wrote:
> Jorge wrote:
> > On Jan 13, 11:15 am, Jorge <jo...(a)jorgechamorro.com> wrote:
> >> No. Reflows happen as needed. E.g. simply reading an .offsetWidth can
> >> trigger a reflow.
>
> > And 5 lines later, in the very same piece of code, reading it again
> > might trigger yet another reflow.
>
> Another _recalculation_ of the offsetWidth, but only if something
> changed in between.  So what?

You ought to watch this, from beginning to end:
"Faster HTML and CSS: Layout Engine Internals for Web Developers"
http://www.youtube.com/watch?v=a2_6bGNZ7bA
--
Jorge.