How much faster is INLINE?

Previous topic - Next topic

Wampus

How much faster is INLINE for routines that won't need specialised GLBasic commands? Anyone written any code that could be used to compare?

Example of what I would try to use INLINE for: I have an A* pathfinding routine written in GLBasic. The GLBasic PATHFIND() is x2.8 times faster. Previously the speed my routine runs at wasn't an issue for what I was using it for but now I have a use for it that would benefit from as much optimisation as possible.

Moebius

Remember that your GLBasic code ends up as C++, so unless you're using pointers to optimise things, I doubt that you could get a significant speed change.
I had to optimise creating, updating, and deleting particles held in an array, and I was able to get some more speed out of it, but only by using pointers to transfer values when deleting masses of particles from the front of the array.

I'm not sure what your routine looks like, but unless you can see areas of code where using pointers could aid in looping through arrays, from my experience, I doubt that you would be able to get much out of converting it to C++.
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

hardyx

Inline code is faster, but GLBasic routines are optimized and your C code can be unoptimized. For example if you code a INLINE routine that is copying data in a loop, can be slowest than a pointer code.

Wampus

Ah well. Thanks for the help & suggestions.

I've already altered the typical A* where I could using optimisations recommended in an article I found by someone who'd written an A* routine in C#.

Since my routine has to do more than FINDPATH() and looping through arrays has been greatly reduced or even substituted for faster methods entirely I don't know that INLINE would help much.

Kitty Hello

The findpath algorithm I use is highly optimized. I doubt you can beat it easily.

Wampus

Seems so. With 4 directions your algorithm is at least 2.8 times faster. If I increase directions to 8 or more I get figures like 3.6 times faster and upwards.