From f50067dfa67b50a4c9b407e0c46ee2525724531b Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 1 Jan 2014 12:52:47 -0500 Subject: [PATCH] Performance - Improved I/O performance with better buffer default sizes to reduce the number of reallocations. --- ChangeLog | 5 +++-- src/File.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c96f06fb..30a90e708 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,8 +10,8 @@ Features Gill). + #1226 A new French translation has begun, and will continue to be a work in progress for a while (thanks to YBSA R). - + #1227 A new 'verify_l10n' utility ensures the localizations are in sync (thanks to - Wim Schuermann). + + #1227 A new 'verify_l10n' utility ensures the localizations are in sync + (thanks to Wim Schuermann). + #1250 Support out-of-tree test runs (thanks to Jakub Wilk). + #1256 Supports default values for UDA fields (thanks to Thomas Sullivan). + #1297 The task₋sync(5) man pages is rewritten with examples. @@ -50,6 +50,7 @@ Features FreeBSD (thanks to Pietro Cerutti). + Performance improvements: + Optimizes indexing into pending.data for direct task access. + + Improved I/O performance with better defaults for buffer sizes. Bugs + #1195 Random seed not random enough - removed all random number code (thanks diff --git a/src/File.cpp b/src/File.cpp index ca5146ca6..9ddb8aac7 100644 --- a/src/File.cpp +++ b/src/File.cpp @@ -196,12 +196,13 @@ bool File::waitForLock () void File::read (std::string& contents) { contents = ""; + contents.reserve (size ()); std::ifstream in (_data.c_str ()); if (in.good ()) { std::string line; - line.reserve (1024); + line.reserve (512 * 1024); while (getline (in, line)) contents += line + "\n"; @@ -219,7 +220,7 @@ void File::read (std::vector & contents) if (in.good ()) { std::string line; - line.reserve (1024); + line.reserve (512 * 1024); while (getline (in, line)) contents.push_back (line);