Performance

- Added std::string::reserve in high-use locations.
- Used Task::get_date over Task::get where possible.
- Added missing code (bug) for waking up any completed tasks that are freshly
  waited.
- Greater use of STL methods for bulk copying.
This commit is contained in:
Paul Beckingham
2012-04-27 02:46:01 -04:00
parent cd552231e9
commit 2668b04901
2 changed files with 29 additions and 15 deletions

View File

@@ -200,6 +200,7 @@ void File::read (std::string& contents)
if (in.good ())
{
std::string line;
line.reserve (1024);
while (getline (in, line))
contents += line + "\n";
@@ -217,6 +218,7 @@ void File::read (std::vector <std::string>& contents)
if (in.good ())
{
std::string line;
line.reserve (1024);
while (getline (in, line))
contents.push_back (line);
@@ -357,6 +359,7 @@ std::string File::read (const std::string& name)
if (in.good ())
{
std::string line;
line.reserve (1024);
while (getline (in, line))
contents += line + "\n";
@@ -375,6 +378,7 @@ bool File::read (const std::string& name, std::string& contents)
if (in.good ())
{
std::string line;
line.reserve (1024);
while (getline (in, line))
contents += line + "\n";
@@ -394,6 +398,7 @@ bool File::read (const std::string& name, std::vector <std::string>& contents)
if (in.good ())
{
std::string line;
line.reserve (1024);
while (getline (in, line))
contents.push_back (line);