Re: dealing with very big (upto 1Gb) svg file

HelderMagalhaes <[email protected]> Mon, 15 Feb 2010 12:16:30 -0800 (PST)
Newsgroups gmane.comp.mozilla.devel.svg
Organization http://groups.google.com
Message-ID <3fe479fc-74fe-48b8-acc8-422e2ce32b3b@y33g2000yqb.googlegroups.com>
> > but can I use different fill colors for subpaths? (i.e red color to values
> > from 0.50 to green color for values upto 0.99)
>
> No, subpaths are all painted with the same paint of the path element.
> However, if you take some time to sort things into the same colors,
> then you could group all same-colors into one path.

Along with the whitespace optimizations already described, I'd also
give emphasis towards property sharing. This will reduce memory and
speed up loading. So, instead of:

  <rect fill="red" stroke="none" x="10" width="10" height="10"/>
  <rect fill="green" stroke="none" x="20" width="10" height="10"/>
  <rect fill="blue" stroke="none" x="30" width="10" height="10"/>

One could simply write:

  <g fill="red" stroke="none">
    <rect stroke="none" x="10" width="10" height="10"/>
    <rect fill="green" x="20" width="10" height="10" />
    <rect fill="blue" x="30" width="10" height="10"/>
  </g>

This works pretty well if you are able to identify a set of shared
property values. The gains become more obvious as the number of child
elements increase.

Also, you may find CSS interesting for avoiding repetitive style-
related attributes: just create a class for them! :-)

Finally, you may also use XML entities for repetitive text, if you can
identify such patterns. ;-)


Hope this helps,
 Helder