← Back to team overview

kicad-developers team mailing list archive

Re: slow PCB_IO::Save()

 

>>> Dick,
>>>
>>> I wonder if this has anything to do with the fact that I used
>>> wxFileOutputStream instead of wxFFile.  It's possible the overhead of
>>> the output stream is causing the performance problems but you wouldn't
>>> think so.
>>
>> Yep, that was it.  I wrote new class FILE_OUTPUTFORMATTER and it is  10 times faster than
>> STREAM_OUTFORMATTER for file streams.  STREAM_OUTPUTFORMATTER is now far less useful,
>> perhaps only for writing to a zip file or socket, or something purely academic that will
>> never happen.
> I wouldn't have guessed that it would be that much of a difference.  Go 
> figure.  We should probably do a global search and replace of any other 
> instances of wxFileOutputStream.  

A moderately sized 6 layer board had been taking about 14-16 seconds to PCB_IO::Save() on
my super fast computer.  Now its less than 2 seconds.

Besides being 8-10 times faster, FILE_OUTPUTFORMATTER is also breeze to use, since the
constructor does more work.

I removed usage of STREAM_OUTPUTFORMATTER in favor of FILE_OUTPUTFORMATTER throughout the
code base.

Might have broken something somewhere, did not have time to test each change, small but
finite risk here.

Dick




References