Integer Performance Part II

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by mdkrsta.

Since PB 3.61 should come with some speed improvements I had high expectations because I'm using a lot of arrays and integers in my current project. Some statements now run faster than before but unfortenately there are also some that got slower.

The simple statement f(a+b)=0 for example is about 25% slower on my P4 1.7GHz.

The following benchmark is some sort of killer app for PB because BB is twice as fast on it. The performance drop in PB from 3.51 to 3.61 is 20%.

OpenConsole()
ti=gettickcount_()
b=1000
c=123
d=12345
e=32000
f=70
For i=1 To 100000000
j=i+j
a=b+15-c+d
j=j+1
a=a-1
j=j+15
a=a-15
a=a+b
b=a-c
Next
Print(Str(gettickcount_() - ti))
Input()

Fred, when doing improvements please run some regression tests to be sure not to make other things worse.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

Interesting, I will take a closer look. Thanks for sharing the tests !

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by theogott.

Just want to say at this place that "Integer Speed" near at ASM-Level is strongly CPU dependent.

At optimal "code-placing" an AMD Athlon can execute three
Opcodes in ONE Clock cycle.

On a Intel CPU you have other characteristics cause the same code will be slower here and faster there.

So Speed-Tests with tolerances about 10% somehow be CPU-dependent.



*************************
The best time to do things is now !
Post Reply