large doc, combine clips, any help w/ performance?

Post questions on how to use or achieve an effect in Inkscape.
User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

large doc, combine clips, any help w/ performance?

Postby brynn » Sun Nov 13, 2011 8:07 am

Hi Friends,
I'm working with an original Inkscape file, which I just realize is going to be huge, when finished. I'm going for a realistic look, so lots of gradients, blurs and clipping. I'm curious if combining objects in a clip will help any with the inevitable performance issues that I'll probably encounter. So for example, in one leaf I might have 4 or 5 shadow and 4 or 5 highlight shapes, all that need to be clipped. (and there are approx 15 leaves) Whether I clip them individually as I go, resulting in up to 10 identical clipping paths, or whether I use one clipping path on all of them together, will that help much in the end, as far as file size and/or performance?

I do know about using layers and Vacuum Defs, but I'm just looking for every little bit of help.
Thanks for your help :D

Edit
Oops, one more question. If I have a situation where a blur will work as well as a gradient, is one better than the other in the end, as far as file size and performance?

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: large doc, combine clips, any help w/ performance?

Postby brynn » Sun Nov 13, 2011 9:05 am

Well I was thinking someone might already know the answer to the blur vs gradient question. But I decided to do a little test anyway.

I created a new Inkscape doc with 2 small circles and 2 large circles. Then I saved that file, and 2 copies of that file. I opened one copy, blurred each circle to 40% and saved. And next I opened the other identical file and made those circles with radial gradient fills. The original is 4.76 kb, the blurred file is 5.75 kb, and the gradient file is 7.23 kb.

I would guess that if I increase the blur value, the blur and gradient files will be closer in size..... Ok, I'll test.
Well that's interesting! Increasing the blur did nothing to the file size. I don't know why I thought so, but I did think that increasing blur values would increase the file size. But it seems it's something else about the blur/filter that causes the increase in file size.

Ok, now I wonder if adding stops to the gradient will increase the file size....
Hhhm, well that hypothesis was proven! I added 3 stops to each radial gradient, and the file size increased to 8.25. And these are all fully opaque stops. I'm not sure if transparency would make any difference.... Ok, I changed one stop in each gradient to 0 opacity (transparent) and one in each to 50%. Now the file size is 8.26. So not much change there.

So as far as gradient vs blur, it looks like the gradient will add to performance issue more than blur, and even more so, the more gradient stops that are used. But transparency in the gradient doesn't have much affect on the file size.

I guess I could also do a test for my question about the clips, but it will take longer. Maybe someone will know that answer before I finish testing?
Thanks again :D

User avatar
prkos
Posts: 1625
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: large doc, combine clips, any help w/ performance?

Postby prkos » Sun Nov 13, 2011 1:12 pm

I don't have time now to go into details, but I don't think you need to worry about file size, SVG is a text format so it's almost by definition very small in file size compared to raster formats, a few kb is not worth mentioning/comparing.

Anything you add to the drawing is recorded as text, all you have to do to see what happens with the file size is keep your XML editor open when editing the file and noticing the new additions to the code.

The greatest issue performance wise is interpreting that text file, making it into a graphical image you see on the screen. In my experience using gradients is waay better than using filters and I use gradients wherever I can. I guess filters lie on much more complex maths/rendering formulas so it takes more CPU/time to calculate everything.

I'd have to check about the clipping many objects at once but maybe only one clipping path is created in the defs element and each file is referred to it so you save some text/file size although I think this way is better because it keeps things tidy and more usable, maybe performance wouldn't be an issue here.
just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: large doc, combine clips, any help w/ performance?

Postby brynn » Sun Nov 13, 2011 6:34 pm

Well this file is already 6.5 MB, and not even halfway done yet! And I know from past experience, that I will have performance issues. They've actually already started at moderately high zoom levels. I don't know how to count the gradients, but they scroll over 2 pages already. So if I can save a few KBs here and there, well, I think every little bit will help.

I'll try watching the XML file when I add new things. Or if I have things grouped, I can look and see how large the groups are. For example, each leaf and each flower, each made up of many objects, will be grouped, so I can move them around without losing parts. So I'll make 2 that are about the same size (dimension) in 2 different ways -- in one, I'll clip individually, and in the other, I'll use just one clipping path on them all. Then I can look in XML editor to see which has more text. That would work, right? (It's the image in this topic that I'm working on viewtopic.php?f=9&t=7580)

Or maybe I'll just do another couple of test docs, when I have a chance.

Thanks prkos :D

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: large doc, combine clips, any help w/ performance?

Postby brynn » Mon Nov 14, 2011 6:50 pm

Just a quick update.
I did do a test on the clipping question. I made 5 shapes and converted to paths, and a 6th one for a clipping path. I saved a copy of the file. In the first one, I clipped all 5 shapes with one clipping path. And in the other one, I clipped each object individually, with duplicates of the clipping path. There's only 0.01 kb difference in file size, so I would call that not significantly different.

Also, I've looked at the XML editor, and except for the 4 digit path id numbers, they are identical. In the doc where I used one clipping path for all 5 objects, it appears that the clipping path was essentially duplicated automatically. The reason I think that, is because when I select each clipped object, the id number for the clipping paths are all different. And I've actually noticed in my work that even if I use one c lipping path for several objects, I can still release the clip for one of them individually, without the others becoming unclipped at the same time.

So all in all, very interesting. At least it's interesting to me, not knowing much about the technical side of Inkscape. I thought having each object clipped individually would result in a larger file size, because there would be more clipping paths. But it turns out that using only one clipping path, it looks like it gets automatically duplicated anyway. And while I knew that gradients and blurs added more to the file size than simple paths or objects, I was surprised that gradients added more. I know that using other filters besides blurs, add much more to the file size than simple blurs, but I still thought it would be more than gradients. And I'm also surprised that increasing a blur does nothing to file size.

Anyway, thanks again :D


Return to “Help with using Inkscape”