[commit] r1109 - trunk/GME/Core

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Mon Dec 27 17:29:36 CST 2010


Author: ksmyth
Date: Mon Dec 27 17:29:36 2010
New Revision: 1109

Log:
Remove superfluous copy for string attributes (save another 6% on Open)

Modified:
   trunk/GME/Core/CoreBinFile.cpp

Modified: trunk/GME/Core/CoreBinFile.cpp
==============================================================================
--- trunk/GME/Core/CoreBinFile.cpp	Mon Dec 27 16:56:41 2010	(r1108)
+++ trunk/GME/Core/CoreBinFile.cpp	Mon Dec 27 17:29:36 2010	(r1109)
@@ -608,25 +608,21 @@
 
 void CCoreBinFile::read(CComBstrObj &ss)
 {
-	std::string s;
-
 	int len;
 
 	read(len);
 	ASSERT( len >= 0 );
 
-	s.resize(len);
 	if( len > 0 ) {
 		if (len > cifs_eof - cifs) {
 			HR_THROW(E_FILEOPEN);
 		}
-		// FIXME: why copy into std::string at all?
-		memcpy(&s[0], cifs, len);
+		CopyTo(cifs, len, &ss.p);
 		cifs += len;
+	} else {
+		std::string s;
+		CopyTo(s, ss);
 	}
-
-
-	CopyTo(s, ss);
 }
 
 void CCoreBinFile::write(const bindata &b)


More information about the gme-commit mailing list