diff options
author | Mathias Stearn <mathias@10gen.com> | 2012-08-10 17:26:06 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2012-08-10 17:38:37 -0400 |
commit | 066d794339538fb020ec0fe9a27be981ea75b0a9 (patch) | |
tree | 554363b04309f0f66af34ad1db992302b4018b69 | |
parent | eee3fe4ce66c7bbda9329a3c8bd8e3549b07437c (diff) | |
download | mongo-066d794339538fb020ec0fe9a27be981ea75b0a9.tar.gz |
Speed-up dur::filename()
-rw-r--r-- | src/mongo/db/dur_recover.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/mongo/db/dur_recover.cpp b/src/mongo/db/dur_recover.cpp index b3f4ce986a2..1d21fe0bb79 100644 --- a/src/mongo/db/dur_recover.cpp +++ b/src/mongo/db/dur_recover.cpp @@ -183,18 +183,24 @@ namespace mongo { }; static string fileName(const char* dbName, int fileNo) { - stringstream ss; + boost::filesystem::path full(dbpath); + + StackStringBuilder ss; + ss << full.string(); +#ifdef _WIN32 + ss << '\\'; +#else + ss << '/'; +#endif ss << dbName << '.'; verify( fileNo >= 0 ); + if( fileNo == JEntry::DotNsSuffix ) ss << "ns"; else ss << fileNo; - // relative name -> full path name - boost::filesystem::path full(dbpath); - full /= ss.str(); - return full.string(); + return ss.str(); } RecoveryJob::~RecoveryJob() { |