.benchmarks

git-svn-id: svn://ultimatepp.org/upp/trunk@12461 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-11-05 08:09:26 +00:00
parent 20c08f99dd
commit 69c334a38e
9 changed files with 12029 additions and 47 deletions

View file

@ -0,0 +1,28 @@
#include <Core/Core.h>
#include <plugin/tess2/tess2.h>
using namespace Upp;
Vector<Vector<Pointf>> TestData();
int N = 100;
CONSOLE_APP_MAIN
{
auto data = TestData();
InVector<double> y;
for(auto& h : data)
for(Pointf p : h)
y.InsertUpperBound(p.y);
RDUMPC(y);
for(int i = 0; i < N; i++) {
Vector<Pointf> vertex;
Vector<int> index;
{
RTIMING("Tesselate");
Tesselate(data, vertex, index, true);
}
}
}

View file

@ -0,0 +1,11 @@
uses
Core,
plugin/tess2;
file
TestData.cpp,
BenchmarkTess.cpp;
mainconfig
"" = "";

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,8 @@ uses
GLDraw;
file
main.cpp;
main.cpp,
data.txt;
mainconfig
"" = "GUI";

View file

@ -0,0 +1,10 @@
TIMING GDI : 82.00 ms - 819.97 us (82.00 ms / 100 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 100
TIMING Painter MT : 237.00 ms - 2.37 ms (237.00 ms / 100 ), min: 1.00 ms, max: 4.00 ms, nesting: 1 - 100
TIMING Painter : 102.00 ms - 1.02 ms (102.00 ms / 100 ), min: 0.00 ns, max: 2.00 ms, nesting: 1 - 100
TIMING OpenGL : 116.00 ms - 1.16 ms (116.00 ms / 100 ), min: 0.00 ns, max: 10.00 ms, nesting: 1 - 100
TIMING GDI : 489.98 ms - 489.98 us (490.00 ms / 1000 ), min: 0.00 ns, max: 2.00 ms, nesting: 1 - 1000
TIMING OpenGL : 650.98 ms - 650.98 us (651.00 ms / 1000 ), min: 0.00 ns, max: 9.00 ms, nesting: 1 - 1000

View file

@ -5,7 +5,7 @@
using namespace Upp;
void GeomTest(Draw& w, Size sz)
void GeomTest121(Draw& w, Size sz)
{
w.DrawRect(sz, White());
for(int y = 0; y < sz.cy; y += 20)
@ -24,13 +24,13 @@ void GeomTest1(Draw& w, Size sz)
w.DrawRect(sz, White());
}
void GeomTest3(Draw& w, Size sz)
void GeomTest11(Draw& w, Size sz)
{
w.DrawRect(sz, White());
w.DrawEllipse(0, 0, sz.cx, sz.cy, Blue());
}
void GeomTest4(Draw& w, Size sz)
void GeomTest(Draw& w, Size sz)
{
w.DrawRect(sz, White());
static const int d[] = { PEN_NULL, PEN_SOLID, PEN_DASH, PEN_DOT, PEN_DASHDOT, PEN_DASHDOTDOT, 1, 2, 3, 10 };
@ -39,46 +39,6 @@ void GeomTest4(Draw& w, Size sz)
w.DrawLine(300, i * 10, 400, i * 10 + 15, d[i], Red());
w.DrawLine(450 + i * 10, 10, 450 + i * 10, 200, d[i], Red());
}
/*
w.DrawRect(sz, White());
Point points[12][2][4];
int subpolygon_counts[12][2];
int disjunct_counts[12];
Point lpoints[12][5];
int lcounts[12][2];
Pointf center(300, 300);
static const double out_delta = 2 * M_PI / 24;
static const double in_delta = 2 * M_PI / 48;
for(int i = 0; i < 12; i++) {
double angle = i * 2 * M_PI / 12;
points[i][0][0] = Polar(center, 200, angle);
points[i][0][1] = Polar(center, 120, angle - out_delta);
points[i][0][2] = Polar(center, 40, angle);
points[i][0][3] = Polar(center, 120, angle + out_delta);
points[i][1][0] = Polar(center, 160, angle);
points[i][1][1] = Polar(center, 120, angle + in_delta);
points[i][1][2] = Polar(center, 80, angle);
points[i][1][3] = Polar(center, 120, angle - in_delta);
subpolygon_counts[i][0] = 4;
subpolygon_counts[i][1] = 4;
disjunct_counts[i] = subpolygon_counts[i][0] + subpolygon_counts[i][1];
lpoints[i][0] = Polar(center, 260, angle + in_delta);
lpoints[i][1] = Polar(center, 230, angle);
lpoints[i][2] = Polar(center, 260, angle - in_delta);
lcounts[i][0] = 3;
lpoints[i][3] = Polar(center, 280, angle + in_delta);
lpoints[i][4] = Polar(center, 280, angle - in_delta);
lcounts[i][1] = 2;
}
w.DrawPolyPolyPolygon(points[0][0], sizeof(points) / sizeof(Point),
subpolygon_counts[0], sizeof(subpolygon_counts) / sizeof(int),
disjunct_counts, sizeof(disjunct_counts) / sizeof(int),
LtBlue(), 4, LtRed(), I64(0xF0F0F0F00F0F0F0F));
w.DrawPolyPolyline(lpoints[0], sizeof(lpoints) / sizeof(Point),
lcounts[0], sizeof(lcounts) / sizeof(int),
4, Color(0, 192, 0));
*/
}
void GeomTest2(Draw& w, Size sz)
@ -156,7 +116,7 @@ void GeomTest2(Draw& w, Size sz)
}
Size sz(1000, 1000);
const int N = 10;
const int N = 1000;
struct Test : GLCtrl {
virtual void GLPaint() {
@ -173,6 +133,7 @@ struct Test : GLCtrl {
// glFinish();
}
}
/*
for(int i = 0; i < N; i++) {
ImagePainter tw(sz);
RTIMING("Painter");
@ -183,7 +144,9 @@ struct Test : GLCtrl {
tw.Co();
RTIMING("Painter MT");
GeomTest(tw, sz);
tw.Finish();
}
*/
for(int i = 0; i < N; i++) {
ImageDraw tw(sz);
RTIMING("GDI");

View file

@ -0,0 +1,31 @@
#include <Core/Core.h>
using namespace Upp;
int N = 10;
CONSOLE_APP_MAIN
{
Vector<float> iv;
for(int i = 0; i < 11000; i++)
iv.Add((float)Randomf());
InVector<float> y, yb[100];
Vector<float> vy;
for(int i = 0; i < N; i++) {
{
y.Clear();
RTIMING("Insert");
for(float v : iv)
y.InsertUpperBound(v);
}
{
vy.Clear();
RTIMING("Insert2");
for(float v : iv)
vy.Insert(FindUpperBound(vy, v), v);
}
}
RDUMP(y);
RDUMP(vy);
}

View file

@ -0,0 +1,11 @@
description "Test for tesselator idea\377";
uses
Core;
file
InVector20000.cpp;
mainconfig
"" = "";

View file

@ -185,7 +185,7 @@ void PaintLion(Painter& sw)
sw.Move(p[0].x, p[0].y);
for(int j = 1; j < p.GetCount(); j++)
sw.Line(p[j].x, p[j].y);
sw.Stroke(2, l[i].color);
// sw.Fill(l[i].color);
// sw.Stroke(2, l[i].color);
sw.Fill(l[i].color);
}
}