[fpc-pascal] Implementing AggPas with PtcGraph
Martin Schreiber
mse00000 at gmail.com
Fri Jun 23 17:36:45 CEST 2017
On Thursday 22 June 2017 18:47:40 James Richters wrote:
> I squeezed a little more out of putimage by doing as little math as
> possible with a couple of variables to store j*ptcwidth and i+j*ptcwidth I
> got my 1000x test loop down to 1.013 seconds. Here is what it looks like
> at the moment, any ideas on how to optimize it further?
>
"
var
pixels:Pword;
k: longint;
i, j, y1, x1, deltaX, deltaX1, deltaY: smallint;
JxW, I_JxW: Longword;
sourcepo,destpo,endpo: pcard16;
[...]
XORPut:
Begin
for j:=Y to Y1 do
Begin
JxW:=j*PTCWidth;
inc(k,deltaX);
sourcepo:= @pt(bitmap)[k];
destpo:= @pixels[jxw+x];
endpo:= destpo+x1-x;
inc(k,x1-x+1);
while destpo <= endpo do begin
destpo^:= destpo^ xor sourcepo^ and colormask;
inc(sourcepo);
inc(destpo);
end;
{
for i:=X to X1 do
begin
I_JxW:=i+JxW;
pixels[I_JxW] := pixels[I_JxW] xor (pt(bitmap)[k] and
ColorMask);
inc(k);
end;
}
inc(k,deltaX1);
End;
End;
"
On 32 bit Linux with 1024x768 screen and bitmap:
FPC 3.0.3 -O-:
1001 runs
origin 2.2167833261452355E+000 ms per put
mse 2.0649356462366574E+000 ms per put
FPC 3.0.3 -O3:
1001 runs
origin 2.2787212782151454E+000 ms per put
mse 6.0739260367848180E-001 ms per put
MSElang with LLVM 3.8.0 backend no optimisation:
1001 runs
origin 1.97338 ms per put
mse 2.03776 ms per put
MSElang with LLVM 3.8.0 backend -O3:
1001 runs
origin 0.406554 ms per put
mse 0.454978 ms per put
The project is here:
https://gitlab.com/mseide-msegui/mselang/tree/master/mselang/benchmark/putimage
Martin
More information about the fpc-pascal
mailing list