Prev: Earn Money from Home as Part Time Job!
Next: FAQ Topic - Why do I get permission denied when accessing a frame/window? (2009-12-27)
From: David Mark on 13 Jan 2010 05:08 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 13 Jan 2010 05:15 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 13 Jan 2010 05:31 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 13 Jan 2010 05:33 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 13 Jan 2010 05:36
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. |