[fpc-pascal] GLM library alternative?

Mattias Gaertner nc-gaertnma at netcologne.de
Mon May 29 13:24:28 CEST 2017


On Mon, 29 May 2017 15:29:24 +0700
Ryan Joseph <ryan at thealchemistguild.com> wrote:

> > On May 29, 2017, at 12:58 PM, Anthony Walter <sysrpl at gmail.com> wrote:
>[...]
> It’s buried now but look at the “FPC Graphics options” thread from a few days ago and spanning back weeks I think. After all that I still failed to get a clear answer I could understand well but some poor loop optimization and floating point division was causing a ray caster example written in Java to get low single digit frame rates where the same code ran 40+fps in Java and C. There seems to be some changes in FPC 3.1.1 but I’m not sure what changed. Some one else may correct what I said but feel free to take a loop. Bottom line for me is I’m nervous about loops in highly optimized low level code now but that may be unfounded.

I will try to summarize the thread:

Jonas told that the benchmark program contains a number of bugs/wrong
translation from the C code:
1) casting a floating point number to an int in C does not round
2) The usage of floor in the test program is wrong.
3) The Pascal version uses longword instead of int32...getting evaluated as 64 bit on 32 bit
4) frac() is only used to get a monotonous increasing value...

C compilers know what "floor" is doing and optimizes it.

FPC default config does not use optimal settings for todays machines.
Java does, C libs do. I didn't find what Graeme used for his C version.

Some pointed out that the Math unit misses some SSE and double
versions of functions.

Florian improved FPC 3.1.1 boosting the speed from 8 to 23FPS.

Martin used MSELang with LLVM backend, fixed some bugs in the code and
used some optimization flags to get 41 FPS, which looks similar to
Graeme's numbers for the C and Java version.

There were various suggestions for optimizations, which C compilers are
doing and could be added to FPC, but they would be specific to these
benchmarks. Including some loop optimizations.

Mattias



More information about the fpc-pascal mailing list