Re: Firefox running very slow when batch change svg elements' property

Brian Birtles <[email protected]>
Newsgroups gmane.text.xml.svg.devel
Message-ID <[email protected]>
Hi Renjun,

Do you mind filing a bug for this?

 
https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&component=SVG&keywords=perf

Thanks!

Brian

(2013/06/25 10:20), rjzhou_ustc wrote:
> Dear all,
>
> My SVG is as follows:
> ---------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
> "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-flat-20030114.dtd">
> <svg xmlns="http://www.w3.org/2000/svg"
> xmlns:xlink="http://www.w3.org/1999/xlink" onload="init(evt)">
> <script type="text/javascript"><![CDATA[
>
> function init(evt){
> var _SVGNS_ = "http://www.w3.org/2000/svg";
> for(i=0;i<60;i++){
> for(j=0;j<50;j++){
> var group=document.createElementNS(_SVGNS_,"g");
> group.setAttributeNS(null,'transform','translate('+(i*10)+'
> '+(j*10+50)+')');
>
> var circle=document.createElementNS(_SVGNS_,"circle");
> circle.setAttributeNS(null,'r',2);
>
> group.appendChild(circle);
> document.documentElement.appendChild(group);
> }
> }
> }
>
> function show(){
> //console.time('show');
> var circles=document.getElementsByTagName('circle');
> for(i=0,len=circles.length;i<len;i++){
> circles[i].style.setProperty('display','inherit','');
> }
> //console.timeEnd('show');
> }
>
> function hide(){
> //console.time('hide');
> var circles=document.getElementsByTagName('circle');
> for(i=0,len=circles.length;i<len;i++){
> circles[i].style.setProperty('display','none','');
> }
> //console.timeEnd('hide');
> }
>
> ]]></script>
> <rect width="60" height="40" fill="red" onclick="show()"/>
> <rect x="70" width="60" height="40" fill="blue" onclick="hide()"/>
> </svg>
>
> ---------------------------------------------------
>
> In Firefox:
> When click the blue rect, hide all circles quickly. But when click the
> red rect, it's very slow.
>
> In IE and Chrome:
> Both are fast.
>
> Why slow in firefox? How to solve if using Firefox? Thanks in advance.
>
> Best,
> Renjun
>
> 



------------------------------------

-----
To unsubscribe send a message to: [email protected]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
----Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.