On Thu, Apr 16, 2009 at 1:27 PM, Pascal <[email protected]> wrote:
>
>> > Creation of individual DOM elements in javascript seems to be pretty slow
>> > (it is a bit faster in the new generation browsers ff3, Safari4 and chrome)
>> > but setInnerHTML() doesn't create those elements in javascript, it is done
>> > natively in the browser and thus is much faster.
>>
>> I'd need to see a benchmark that that is indeed the case.  I don't
>> have time right now (I'll experiment later if I have the chance).  But
>> it seems wrong that creating the DOM elements in javascript is slower
>> than having the browser do it natively (the cost of modifying the DOM
>> should be the dominant factor by far).
>
> Seriously, this is not even close. In IE for a table as small as 50
> rows with 15 columns, you're looking at a few seconds with the DOM and
> below 100ms with innerHTML. (on a dev laptop here anyway).
Me thinks there might a problem with your testing methodology.  First
I think you're not taking into account the building of the string
whereas you do time the widget creation.  Secondly, if you have a
constant 50 rows & 15 columns, see how long it takes to set the data
once you've pre-created your widgets (this should actually be faster I
think than innerHTML if you have HTML elements there).
Thirdly IE is the slowest browser (Javascript is actually notoriously
slower  - not sure about DOM, but even that is still slower than any
other browser).  At least tell me you're testing with IE7 (which is
still what, 2x slower than FF3.0 & 5 times slower than FF3.5).
Fourthly, I'd prefer to use something like Firebug's profiling rather
than trying to instrument my own code - it's far less likely you'll
make a mistake or misinterpret the data I think.

> >
>

--~--~---------~--~----~------------~-------~--~----~
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