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]