mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.benchmarks
git-svn-id: svn://ultimatepp.org/upp/trunk@9275 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
c1ff54b280
commit
612e7f3226
3 changed files with 71 additions and 0 deletions
58
benchmarks/Vector/Vector.cpp
Normal file
58
benchmarks/Vector/Vector.cpp
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
Buffer<String> data(2000);
|
||||
Buffer<std::string> sdata(2000);
|
||||
|
||||
for(int i = 0; i < 2000; i++) {
|
||||
data[i] = AsString(i);
|
||||
sdata[i] = data[i].ToStd();
|
||||
}
|
||||
|
||||
for(int j = 0; j < 10000; j++) {
|
||||
{
|
||||
RTIMING("vector<string>::push_back");
|
||||
std::vector<std::string> v;
|
||||
for(int i = 0; i < 2000; i++)
|
||||
v.push_back(sdata[i]);
|
||||
}
|
||||
{
|
||||
RTIMING("vector<String>::push_back");
|
||||
std::vector<String> v;
|
||||
for(int i = 0; i < 2000; i++)
|
||||
v.push_back(data[i]);
|
||||
}
|
||||
{
|
||||
RTIMING("Vector<String>::Add");
|
||||
Vector<String> v;
|
||||
for(int i = 0; i < 2000; i++)
|
||||
v.Add(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for(int j = 0; j < 100; j++) {
|
||||
{
|
||||
RTIMING("vector<string>::insert");
|
||||
std::vector<std::string> v;
|
||||
for(int i = 0; i < 2000; i++)
|
||||
v.insert(v.begin(), sdata[i]);
|
||||
}
|
||||
{
|
||||
RTIMING("vector<String>::insert");
|
||||
std::vector<String> v;
|
||||
for(int i = 0; i < 2000; i++)
|
||||
v.insert(v.begin(), sdata[i]);
|
||||
}
|
||||
{
|
||||
RTIMING("Vector<String>::Insert");
|
||||
Vector<String> v;
|
||||
for(int i = 0; i < 2000; i++)
|
||||
v.Insert(0, data[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
9
benchmarks/Vector/Vector.upp
Normal file
9
benchmarks/Vector/Vector.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
Vector.cpp optimize_speed;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
4
benchmarks/Vector/init
Normal file
4
benchmarks/Vector/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _Vector_icpp_init_stub
|
||||
#define _Vector_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue