From 8c2f07be2a0df6b8c2037e276d9f1750d818b497 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Mon, 3 May 2021 19:10:21 -0400 Subject: [PATCH] Write xml netlists explicitly via wxFFileOutputStream for performance Fix #6944 --- eeschema/netlist_exporters/netlist_exporter_xml.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/eeschema/netlist_exporters/netlist_exporter_xml.cpp b/eeschema/netlist_exporters/netlist_exporter_xml.cpp index c3a6ce5e9a..390f56dd21 100644 --- a/eeschema/netlist_exporters/netlist_exporter_xml.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_xml.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include @@ -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 */ ); }