Performance

- Improved I/O performance with better buffer default sizes to reduce the
  number of reallocations.
This commit is contained in:
Paul Beckingham 2014-01-01 12:52:47 -05:00
parent 68aed90cad
commit f50067dfa6
2 changed files with 6 additions and 4 deletions

View file

@ -10,8 +10,8 @@ Features
Gill). Gill).
+ #1226 A new French translation has begun, and will continue to be a work in + #1226 A new French translation has begun, and will continue to be a work in
progress for a while (thanks to YBSA R). progress for a while (thanks to YBSA R).
+ #1227 A new 'verify_l10n' utility ensures the localizations are in sync (thanks to + #1227 A new 'verify_l10n' utility ensures the localizations are in sync
Wim Schuermann). (thanks to Wim Schuermann).
+ #1250 Support out-of-tree test runs (thanks to Jakub Wilk). + #1250 Support out-of-tree test runs (thanks to Jakub Wilk).
+ #1256 Supports default values for UDA fields (thanks to Thomas Sullivan). + #1256 Supports default values for UDA fields (thanks to Thomas Sullivan).
+ #1297 The task₋sync(5) man pages is rewritten with examples. + #1297 The task₋sync(5) man pages is rewritten with examples.
@ -50,6 +50,7 @@ Features
FreeBSD (thanks to Pietro Cerutti). FreeBSD (thanks to Pietro Cerutti).
+ Performance improvements: + Performance improvements:
+ Optimizes indexing into pending.data for direct task access. + Optimizes indexing into pending.data for direct task access.
+ Improved I/O performance with better defaults for buffer sizes.
Bugs Bugs
+ #1195 Random seed not random enough - removed all random number code (thanks + #1195 Random seed not random enough - removed all random number code (thanks

View file

@ -196,12 +196,13 @@ bool File::waitForLock ()
void File::read (std::string& contents) void File::read (std::string& contents)
{ {
contents = ""; contents = "";
contents.reserve (size ());
std::ifstream in (_data.c_str ()); std::ifstream in (_data.c_str ());
if (in.good ()) if (in.good ())
{ {
std::string line; std::string line;
line.reserve (1024); line.reserve (512 * 1024);
while (getline (in, line)) while (getline (in, line))
contents += line + "\n"; contents += line + "\n";
@ -219,7 +220,7 @@ void File::read (std::vector <std::string>& contents)
if (in.good ()) if (in.good ())
{ {
std::string line; std::string line;
line.reserve (1024); line.reserve (512 * 1024);
while (getline (in, line)) while (getline (in, line))
contents.push_back (line); contents.push_back (line);