mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-29 06:12:18 -06:00
.benchmarks: InVectorCache
git-svn-id: svn://ultimatepp.org/upp/trunk@5854 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
29eb8641d1
commit
42d81a9dec
1 changed files with 28 additions and 0 deletions
|
|
@ -19,6 +19,34 @@ CONSOLE_APP_MAIN
|
|||
}
|
||||
RDUMP(m);
|
||||
}
|
||||
{
|
||||
RTIMING("Simple scan, more complex OP");
|
||||
int m = 0;
|
||||
for(int j = 0; j < N; j++) {
|
||||
for(int i = 0; i < x.GetCount(); i++)
|
||||
if(x[i] > 500)
|
||||
m += x[i];
|
||||
for(int i = x.GetCount(); --i >= 0;)
|
||||
if(x[i] > 500)
|
||||
m += x[i];
|
||||
}
|
||||
RDUMP(m);
|
||||
}
|
||||
{
|
||||
RTIMING("Iterator scan");
|
||||
int m = 0;
|
||||
for(int j = 0; j < N; j++) {
|
||||
InVector<int>::Iterator e = x.End();
|
||||
InVector<int>::Iterator i = x.Begin();
|
||||
while(i != e)
|
||||
m += *i++;
|
||||
e = x.Begin();
|
||||
i = x.End();
|
||||
while(i != e)
|
||||
m += *--i;
|
||||
}
|
||||
RDUMP(m);
|
||||
}
|
||||
{
|
||||
RTIMING("Single InVector, problematic scan");
|
||||
int m = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue