From 5bc47a0c3b94b7d1a117839911b82e76e3910abc Mon Sep 17 00:00:00 2001 From: Mark Roszko Date: Mon, 3 May 2021 23:13:38 +0000 Subject: [PATCH] Write xml netlists explicitly via wxFFileOutputStream for performance Fix #6944 --- .../netlist_exporters/netlist_exporter_generic.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eeschema/netlist_exporters/netlist_exporter_generic.cpp b/eeschema/netlist_exporters/netlist_exporter_generic.cpp index b0e6bf2943..fbdbd68e68 100644 --- a/eeschema/netlist_exporters/netlist_exporter_generic.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_generic.cpp @@ -31,6 +31,7 @@ #include #include #include +#include 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++ ) 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. wxXmlDocument xdoc; 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 */ ); }