Write xml netlists explicitly via wxFFileOutputStream for performance

Fix #6944
This commit is contained in:
Marek Roszko 2021-05-03 19:10:21 -04:00
parent d2a7f81b10
commit 8c2f07be2a
1 changed files with 10 additions and 2 deletions

View File

@ -32,6 +32,7 @@
#include <kicad_string.h>
#include <connection_graph.h>
#include <refdes_utils.h>
#include <wx/wfstream.h>
#include <symbol_lib_table.h>
@ -42,11 +43,18 @@ static bool sortPinsByNumber( LIB_PIN* aPin1, LIB_PIN* aPin2 );
bool NETLIST_EXPORTER_XML::WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions )
{
// output the XML format netlist.
wxXmlDocument xdoc;
// declare the stream ourselves to use the buffered FILE api
// instead of letting wx use the syscall variant
wxFFileOutputStream stream( aOutFileName );
if( !stream.IsOk() )
return false;
wxXmlDocument xdoc;
xdoc.SetRoot( makeRoot( GNL_ALL | aNetlistOptions ) );
return xdoc.Save( aOutFileName, 2 /* indent bug, today was ignored by wxXml lib */ );
return xdoc.Save( stream, 2 /* indent bug, today was ignored by wxXml lib */ );
}