Re: Reconsider SVG 1.2

"Boris Zbarsky" <bzbarsky@MIT.EDU>
> Jim Ley wrote:
>>>(and in some UAs may in fact be faster...).
>>
>> None that I've seen
>
> I can guarantee that setting inline style is faster in Mozilla.  It just 
> does a lot less work.  Also, the implementation of inline style has also 
> been optimized a lot more than the implementation of SVG presentational 
> attributes (being pretty widely used in languages other than SVG).  ;)

Interesting, my tests seemed to show that mozilla was equally slower with 
the setProperty method, I just downloaded the nightly and it acted the same:

element.style.setProperty('fill','red','')

took about twice the time of

element.setAttribute('fill','red')

In fact it was much more pronounced difference than ASV inside IE (the 
script engine being important here of course, the slowest part of the script 
is the extra object lookup inherent in getting the style object)

Of course the speed differences here are tiny, and are mostly down to the 
.style, however even removing that factor mozilla still appeared slower with 
the setProperty than the setAttribute, but as I said, I very much doubt 
speed is an actual reason why people were avoiding setProperty, I will be in 
future though, thanks for encouraging me to check again.

Jim.

Received on Wednesday, 17 November 2004 20:37:48 UTC