]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
add a speed test for std::string::append()
authorbert hubert <bert.hubert@netherlabs.nl>
Fri, 20 Feb 2015 13:23:03 +0000 (14:23 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 20 Feb 2015 13:23:03 +0000 (14:23 +0100)
pdns/speedtest.cc

index 3a7f1c9eeb036770be9951180f67c5ac5a7a4555..20e49f7c31cc80a447919657f455c08c5649e7f6 100644 (file)
@@ -164,6 +164,23 @@ struct VStringtokTest
   }
 };
 
+struct StringAppendTest
+{
+  string getName() const
+  {
+    return "stringappend";
+  }
+  
+  void operator()() const 
+  {
+    string str;
+    static char i;
+    for(int n=0; n < 1000; ++n)
+      str.append(1, i);
+    i++; 
+  }
+};
+
 
 struct MakeARecordTest
 {
@@ -898,6 +915,7 @@ try
 
   doRun(StringtokTest());
   doRun(VStringtokTest());  
+  doRun(StringAppendTest());  
 
   cerr<<"Total runs: " << g_totalRuns<<endl;