Write xml netlists explicitly via wxFFileOutputStream for performance

Fix #6944
This commit is contained in:
Mark Roszko 2021-05-03 23:13:38 +00:00
parent f2db83008a
commit 5bc47a0c3b
1 changed files with 9 additions and 1 deletions

View File

@ -31,6 +31,7 @@
#include <class_library.h> #include <class_library.h>
#include <sch_base_frame.h> #include <sch_base_frame.h>
#include <symbol_lib_table.h> #include <symbol_lib_table.h>
#include <wx/wfstream.h>
static bool sortPinsByNumber( LIB_PIN* aPin1, LIB_PIN* aPin2 ); static bool sortPinsByNumber( LIB_PIN* aPin1, LIB_PIN* aPin2 );
@ -41,12 +42,19 @@ bool NETLIST_EXPORTER_GENERIC::WriteNetlist( const wxString& aOutFileName, unsig
for( unsigned ii = 0; ii < m_masterList->size(); ii++ ) for( unsigned ii = 0; ii < m_masterList->size(); ii++ )
m_masterList->GetItem( ii )->m_Flag = 0; m_masterList->GetItem( ii )->m_Flag = 0;
// 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;
// output the XML format netlist. // output the XML format netlist.
wxXmlDocument xdoc; wxXmlDocument xdoc;
xdoc.SetRoot( makeRoot( GNL_ALL ) ); xdoc.SetRoot( makeRoot( GNL_ALL ) );
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 */ );
} }