Author Topic: Speed of loop  (Read 1939 times)

0 Members and 1 Guest are viewing this topic.

Aurel

  • Guest
Speed of loop
« on: February 03, 2014, 01:40:25 PM »
Hi Charles
I want to increase speed of loop which read ordinary integer array elements
I tested for,while and do loop and i think that do loop is the fastest.
Also i try with assembler like this:

Code: [Select]
mov ecx,0
again:
....
.....
....
dec ecx
jnz again

But i have found that this way is not faster than with ordinary do
Only thing what i see is that this method use little bit less memory..
Is there a faster way or maybe i do something wrong ..?

Charles Pegge

  • Guest
Re: Speed of loop
« Reply #1 on: February 03, 2014, 03:07:57 PM »
Oxygen compiles to efficient asm/machine code so there is not much to be gained, except in very specific situations, where spare registers can be used instead of variables. But local variables are held on the stack, which is usually contained within the CPU cache (very fast memory).

To get the best performance, ensure that there are no unnecessary repetitions, and turn small, frequently used functions into macros.

Aurel

  • Guest
Re: Speed of loop
« Reply #2 on: February 03, 2014, 09:45:14 PM »
Ok..i will try with macros.. ;)