mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
.benchmarks
git-svn-id: svn://ultimatepp.org/upp/trunk@14393 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
58bef320a4
commit
5f0f425da8
6 changed files with 96 additions and 0 deletions
11
benchmarks/BenchEsc/BenchEsc.upp
Normal file
11
benchmarks/BenchEsc/BenchEsc.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
uses
|
||||
Core,
|
||||
Esc;
|
||||
|
||||
file
|
||||
test.esc,
|
||||
Esc.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
38
benchmarks/BenchEsc/Esc.cpp
Normal file
38
benchmarks/BenchEsc/Esc.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include <Esc/Esc.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
RDUMP(sizeof(EscValue));
|
||||
|
||||
String code = LoadFile(GetDataFile("test.esc"));
|
||||
ArrayMap<String, EscValue> global;
|
||||
|
||||
StdLib(global);
|
||||
|
||||
try {
|
||||
Scan(global, code);
|
||||
EscValue primes;
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
RTIMING("run");
|
||||
primes = Execute(global, "sieve", INT_MAX);
|
||||
}
|
||||
RDUMP(primes);
|
||||
}
|
||||
catch(CParser::Error e) {
|
||||
RLOG(e);
|
||||
}
|
||||
|
||||
RLOG("");
|
||||
RLOG("-----------------------");
|
||||
|
||||
DUMP(global.GetAdd("result"));
|
||||
|
||||
// EscValue v;
|
||||
// v.SetArray().Add(123);
|
||||
// EscValue v2 = v;
|
||||
// v.SetArray().Add(v);
|
||||
// DUMP(v);
|
||||
}
|
||||
14
benchmarks/BenchEsc/test.esc
Normal file
14
benchmarks/BenchEsc/test.esc
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
sieve()
|
||||
{
|
||||
N = 2000;
|
||||
sieve = N * [1];
|
||||
prime = [];
|
||||
for(i = 2; i < N; i++) {
|
||||
if(sieve[i]) {
|
||||
prime[] = i;
|
||||
for(j = i; j < N; j += i)
|
||||
sieve[j] = 0;
|
||||
}
|
||||
}
|
||||
return prime;
|
||||
}
|
||||
|
|
@ -33,6 +33,7 @@ CONSOLE_APP_MAIN
|
|||
// for (int j = 0; j < jsize; ++j)
|
||||
// v[j].Sweep();
|
||||
}
|
||||
return;
|
||||
{
|
||||
Vector<Index<int> > v;
|
||||
v.SetCount(v_num);
|
||||
|
|
|
|||
9
benchmarks/RGBAFill/RGBAFill.upp
Normal file
9
benchmarks/RGBAFill/RGBAFill.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
23
benchmarks/RGBAFill/main.cpp
Normal file
23
benchmarks/RGBAFill/main.cpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
Color c = Red();
|
||||
|
||||
int len = 4000 * 2000;
|
||||
|
||||
Buffer<RGBA> b(len);
|
||||
|
||||
for(int i = 0; i < 1000; i++) {
|
||||
{
|
||||
RTIMING("memsetd");
|
||||
memsetd(b, *(dword*)&(c), len);
|
||||
}
|
||||
{
|
||||
RTIMING("Fill");
|
||||
Fill(b, c, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue