So imagine i have 100 buttons represented by 5 images each for a total of 500 images in my svg document.
Only one of button's 5 images is visible and svg switch at runtime between these images. So, as you said, display engine always walk the rendering tree. I use visibility="hidden" to hide elements. Do you think it's faster to create a plain svg document with 500 items at the same level, or 100 groups with 5 items each? How is navigation speed of rendering tree bound to the number of nested groups? More nesting more speed? I imagine also that using display="none" to hide the 4 hidden images of button is slower because it recreate rendering tree. Thanks, Fabio -----Messaggio originale----- Da: Thomas DeWeese [mailto:[EMAIL PROTECTED] Inviato: luned́ 24 novembre 2003 21.25 A: Batik Users Oggetto: Re: performance 2 Fabio Biscaro wrote: > I'm trying to optimize svg speed in Batik: > > Does someone know if is faster to group elements in <g> or if i put > all > in the svg element? In general it is good to put things in g elements, ideally grouping things geometrically rather than in layers. Going to the extreme (1 element per group) probably isn't a good idea. So for example it would be _really_ good to put all the elements of a button in a group (rather than adding them individually to the button's parent). But it may not gain you too much to put symbols in a separate group if they are still scattered across the whole canvas. > When via javascript i hide an element does the position of this > element > matter? How are you hiding an element? If you are doing visibility="hidden" then the display engine must still walk the rendering tree as children can override this. If you use display="none" then the rendering tree is removed - however when/if you change it back to display="inline" the rendering tree must then be recreated from scratch. Also moving elements in the DOM tree deletes the old rendering tree and creates a new rendering when inserted so this can be expensive. > If I get a reference of an object in Javascript via getElementById and > then i use that reference is faster than using always getElementById? ( > I imagine yes!) Yes, keeping the reference around is much much much faster. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]