Oh, I just noticed you're replying to messages from a few days ago.  Oops!

There is no right way of going about optimisation.  I'm of the school that if you can give the compiler a helpful hint, without complicating the code, then do it.

In one way I compare it to the id Tech (Quake) and Unreal engines back in the 90s and early 2000s.  When making maps, the id Tech engines attempted to compile everything itself when it came to determining what was visible and what it should cull - as a result, the compilation process would take a long time and there were some situations where it could easily fall apart due to rounding errors or just some glitch in the tree.  The Unreal engine, on the other hand, had /you/, the map designer, decide what was visible and what wasn't, and had you decide where to place portals and other hints to the engine.  This was useful because it was much easier to subdivide areas if you were sensible about it and hence the Unreal engine could handle much more complex outdoor scenes, for example.  The cost though, especially with later versions of the Unreal engine that added more features, is that it was very hard for a novice to get started - for example, the 'terrain' feature didn't do any automatic visibility culling, so if you had a large hill, for example, you would have to insert an 'anti-portal' underneath it to give a hint to the engine that if it is within the viewport, any polygons behind it is invisible (which causes very weird artefacts if you place one in the middle of an open room).

I like to take a middle ground, especially as the Pascal compiler has a reputation of being fast.  A smart compiler is a good compiler, but expecting it to be able to know which procedures should be auto-vectorised, especially with old source code and no rules on memory alignment, it's either impossible or will take a disproportinately long time.  Other times it's an excuse for lazy programming!

As for the vectorcall tests, they should vectorise the entire argument on both x86_64-win64 and x86_64-linux.  If not, there's a bug somewhere.  I'll have a look.

Gareth aka. Kit

This email has been checked for viruses by Avast antivirus software.
fpc-devel maillist  -  fpc-devel@lists.freepascal.org

Reply via email to