git repos / oastat

commit 17d0c280

sago007 · 2018-12-03 16:37
17d0c280ed2a0cd1a3e139b5836272f47019cce3 patch · browse files
parent cfbce4e73282423486b850073f6d420c6e644412

Disabled iosync. Improves performance by about 10%

Changed files

M src/oastat.cpp before
M src/oastatstruct.cpp before
diff --git a/src/oastat.cpp b/src/oastat.cpp index 59c2f07..7793418 100644 --- a/src/oastat.cpp +++ b/src/oastat.cpp
@@ -94,7 +94,7 @@ static void addCommands(std::shared_ptr<Database> &db,std::vector<std::shared_pt
commands.push_back(std::shared_ptr<Struct2Db>(new Accuracy2Db()) );
//Add more commands just above here
- for (unsigned int i=0; i<commands.size(); i++) {
+ for (size_t i=0; i<commands.size(); i++) {
commands.at(i)->setDb(db);
}
}
@@ -127,7 +127,7 @@ static int processStdIn(std::istream &in_p, std::vector<std::shared_ptr<Struct2D
while(!osslist.empty()) {
oss = osslist.front();
osslist.pop_front();
- for(unsigned int i=0; i<commands.size(); i++) {
+ for(size_t i=0; i<commands.size(); ++i) {
if(commands.at(i)->canProcess(oss)) {
commands.at(i)->process(oss);
}
@@ -177,6 +177,7 @@ std::string getHashedId(const std::string& unhashedID)
int main (int argc, const char* argv[])
{
try {
+ std::ios_base::sync_with_stdio(false);
std::string dbargs = "";
std::string backend = "Xml";
bool doIntegrationTest = false;
diff --git a/src/oastatstruct.cpp b/src/oastatstruct.cpp index 895b8a4..7bfc61b 100644 --- a/src/oastatstruct.cpp +++ b/src/oastatstruct.cpp
@@ -29,7 +29,7 @@ https://github.com/sago007/oastat/
static void makeLower(std::string &x)
{
- for (unsigned int i=0; i<x.length(); i++) {
+ for (size_t i=0; i<x.length(); ++i) {
if (x[i] >= 'A' && x[i] <= 'X') {
x[i] = x[i]-'A'+'a';
}
@@ -93,7 +93,7 @@ void OaStatStruct::parseLine(const std::string& orgLine)
std::map<std::string,std::string> OaStatStruct::GetInfostring(const std::string& restOfLine) const
{
std::map<std::string,std::string> list;
- unsigned int lastPos = 0;
+ size_t lastPos = 0;
bool iskey = true;
std::string key;
if (restOfLine[0] == '\\') {