Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing long paths to file takes a while #6

Closed
derVedro opened this issue Feb 4, 2017 · 2 comments
Closed

Writing long paths to file takes a while #6

derVedro opened this issue Feb 4, 2017 · 2 comments

Comments

@derVedro
Copy link
Contributor

derVedro commented Feb 4, 2017

Saving long paths with a lot of segments is really slow. I figured out svgwrite runs by default with some debug flags. Svgwrite does some validation stuff like checking syntax of path's d attribute. The parser that they use runs amok.

I think the best approach is to disable debug mode and to turn validation off (#7). The data you put into svgwrite is valid, paths are syntactically correct. And if some arguments are broken, most programs can deal with it.

@mathandy
Copy link
Owner

mathandy commented Feb 6, 2017

Hi derVedro, thanks for pointing this out!
I don't know what the debug flag in svgwrite.Drawing does and I'm not sure why the makers of svgwrite set this flag to True by default. Without that knowledge I'm too nervous to merge in your requested default overriding of their default. Especially since...

A simple (though not obvious) workaround also exists:

from svgpathtools import *
wsvg(Path(Line(0, 100+100j)), svg_attributes={'debug': False})

From the one %timeit test I did, this does appear to provide a significant speed increase. I just made a note of this in the disvg docstring.

@mathandy mathandy closed this as completed Feb 6, 2017
@derVedro
Copy link
Contributor Author

derVedro commented Feb 6, 2017

I use this workaround already for a while and it works allways (for my stuff). A note in docstring is a good deal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants