.benchmarks

git-svn-id: svn://ultimatepp.org/upp/trunk@15436 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-11-16 22:57:09 +00:00
parent 3faa148c44
commit 198409cf7b
3 changed files with 17 additions and 3 deletions

View file

@ -72,6 +72,7 @@ CONSOLE_APP_MAIN
RDUMP(hst.size());
}
}
return;
w = AliceLines();

View file

@ -2,7 +2,20 @@
Vector<String> AliceWords()
{
return Split(alice_text, [](int c) { return c > 32 ? 0 : c; });
Vector<String> w = Split(alice_text, [](int c) { return c > 32 ? 0 : c; });
Vector<String> r;
for(String s : w) {
s = ToLower(s);
int q = 0;
while(!IsAlNum(s[q]) && q < s.GetCount())
q++;
s = s.Mid(q);
while(s.GetCount() && !IsAlNum(*s.Last()))
s.TrimLast();
if(s.GetCount())
r.Add(s);
}
return r;
}
Vector<String> AliceLines()

View file

@ -6,7 +6,7 @@ using namespace Upp;
CONSOLE_APP_MAIN
{
const int N = 200;
const int N = 2000;
Vector<String> data;
Buffer<std::string> sdata(N);
@ -19,7 +19,7 @@ CONSOLE_APP_MAIN
RDUMP(sizeof(std::string));
RDUMP(sizeof(String));
for(int q = 100000; q--;) {
for(int q = 1000; q--;) {
{
RTIMING("vector<string>::push_back");
std::vector<std::string> v;