faster "save as" .dxf, or at least a % progress indicator

General discussions about Inkscape.
CraiginNJ
Posts: 3
Joined: Sat Mar 08, 2008 4:26 am

faster "save as" .dxf, or at least a % progress indicator

Postby CraiginNJ » Sun Mar 09, 2008 1:42 am

"Save as" .dxf took nearly an hour for a 1.7MB vector .svg I created by doing Trace Bitmap of a .jpg scan that contained a lot of dirt/shadow noise along one side. I'm using 0.45.1-1.win32 on Vista Business on a Core2Duo 2GHz PC.

If it can't be made faster (ideally taking a couple of minutes rather than nearly an hour), I wish it could at least give a visible indication of its % progress. When it takes that long to make a .dxf and gives no indication of progress, one tends to assume inkscape is broken and kill it.

Thanks,

Craig in NJ

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

Re: faster "save as" .dxf, or at least a % progress indicator

Postby prkos » Sun Mar 09, 2008 2:53 am

you should submit a bug/feature request about the .dxf speed Report a bug

Requests for progress bars have already been made, for tracing and exporting in particular. Heres the general one Ability to display progress bar
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
sas
Posts: 404
Joined: Sat Oct 06, 2007 5:42 am

Re: faster "save as" .dxf, or at least a % progress indicator

Postby sas » Sun Mar 09, 2008 3:07 am

Looking at the script, I think I know why it's so appallingly slow (because I once made the same mistake in a Python script). It constructs the DXF file in memory as a string, building it by doing something like

Code: Select all

string_so_far += some_little_string

over and over again. The trouble is that this operation copies string_so_far into a new string, which makes the overall process O(n^2) - which is fine if the output file is small, but incredibly slow for large output files.

The solution is to build the file as a list of strings, so that the basic operation is like

Code: Select all

list_so_far.append(some_little_string)

Then at the end they can be concatenated rapidly by

Code: Select all

"".join(list_so_far)

Please file a bug report, as prkos suggests. If I'm right about the problem, then the fix is trivial. (I've already made a patch, but I haven't tested it yet.)

User avatar
sas
Posts: 404
Joined: Sat Oct 06, 2007 5:42 am

Re: faster "save as" .dxf, or at least a % progress indicator

Postby sas » Sun Mar 09, 2008 5:32 am

No need to file a bug report now, as I've filed one myself: bug 199922.

User avatar
sas
Posts: 404
Joined: Sat Oct 06, 2007 5:42 am

Re: faster "save as" .dxf, or at least a % progress indicator

Postby sas » Mon Mar 10, 2008 11:06 pm

The speed-up is now in the SVN trunk. (But it hasn't been added to the 0.46 branch, so it may not appear in a stable release until 0.47.)


Return to “General Discussions”