From 3bc69d48db7cd54db9c67dedfe82cc13890bcf71 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 30 Sep 2012 22:28:31 +0000 Subject: [PATCH] Small optimization of wxFFile::ReadAll(): avoid extra string copy. Use swap() to move the newly created string into its destination instead of copying it there. This can be relatively important as the string represents an entire file contents here and so could be quite long. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72597 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/ffile.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/ffile.cpp b/src/common/ffile.cpp index 5212066a63..ae19669204 100644 --- a/src/common/ffile.cpp +++ b/src/common/ffile.cpp @@ -117,7 +117,9 @@ bool wxFFile::ReadAll(wxString *str, const wxMBConv& conv) } buf.data()[length] = 0; - *str = wxString(buf, conv); + + wxString strTmp(buf, conv); + str->swap(strTmp); return true; } -- 2.45.2