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

codedread <[email protected]> Sun, 14 Feb 2010 08:05:44 -0800 (PST)
Newsgroups gmane.comp.mozilla.devel.svg
Organization http://groups.google.com
Message-ID <0e8965f1-5373-40ec-ba61-e6d295c959d9@w31g2000yqk.googlegroups.com>
On Feb 14, 6:36 am, meemsheen <[email protected]> wrote:
> Hi,
>
> I have to visualize some values from a big text file with svg rect and with
> different colors,
> but the svg file I generate is so big in size that firefox/safari crashes to
> open it.
>
> Description about the input text file:
>
> Its a comma separated csv text file which contains float values like:
> 0.70, 0.50,0.98,0.78,0.61,0.88.........
> 160 of the above values in one line and more than 100,000 lines.
>
> I have a c script which parse the csv file and writes <rect> tags in svg and
> with style=fill: rgb( , , ) values filled from the input csv file.
>
> If I just parse some 1000 lines from the input csv file the generated svg is
> about 50-100MB and I can
> view it as I wanted, but when I parse more and more, the generated svg
> becomes very big and
> safari/firefox hangs to open this big svg file.
> I have 4GB RAM in my machine.
>
> Any help to deal with this problem or do it in another better way will be
> much appreciated.
>

Is it required to turn everything into rectangles and each one having
a different color?  The browsers may be choking on the number of
elements (rects) since each element adds DOM overhead (memory usage).

Have you looked at parsing the data into SVG path commands?  Using
just one path (with subpaths) for each color would drastically cut
down on memory usage in the browser.

<path fill="blue" d="M100,100 L200,200 z"/>

This would be a path that moves the pen to (100,100) then draws a line
to (200,200), then closes the path.

Jeff