Core: memset8__ micro-optimisation, Painter: Clear fix and co support, new benchmarks

This commit is contained in:
Mirek Fidler 2023-11-11 14:09:10 +01:00
parent 3d4911c266
commit 867efb4927
7 changed files with 108 additions and 3 deletions

View file

@ -0,0 +1,9 @@
uses
CtrlLib;
file
main.cpp;
mainconfig
"" = "GUI";

View file

@ -0,0 +1,46 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
GUI_APP_MAIN
{
ImagePainter iw(4000, 2000);
iw.Co();
for(int i = 0; i < 1000; i++) {
{
RTIMING("Clear");
iw.Clear();
}
{
RTIMING("Clear 2");
iw.Clear();
}
{
RTIMING("Rect");
iw.DrawRect(0, 0, 4000, 2000, White());
iw.Finish();
}
{
RTIMING("Fill");
iw.Circle(2000, 1000, 900).Fill(Blue());
iw.Finish();
}
{
RTIMING("Stroke");
iw.Circle(2000, 1000, 900).Stroke(2, LtRed());
iw.Finish();
}
{
RTIMING("Blend");
iw.Circle(2000, 1000, 900).Fill(200 * Blue());
iw.Finish();
}
}
TopWindow win;
ImageCtrl h;
h.SetImage(iw);
win << h.SizePos();
win.Run();
}

View file

@ -0,0 +1,30 @@
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
Buffer<byte> h(1024*1024*30);
for(int i = 0; i < 1000000; i++) {
{
RTIMING("32KB memset");
memset(h, 0, 1024 * 32);
}
{
RTIMING("32KB memset8");
memset8(h, 0, 1024 * 32);
}
{
RTIMING("32KB memset32");
memset32(h, 31525874, 1024 * 32 / 4);
}
{
RTIMING("32KB loop 32");
dword *s = (dword *)~h;
dword *e = s + 1024 * 32 / 4;
while(s < e)
*s++ = 31515927;
}
}
}

View file

@ -0,0 +1,9 @@
uses
Core;
file
memset.cpp;
mainconfig
"" = "";