Page 1 of 1

Very strange... Speed for loops PureBasic vs BlitzBasic

Posted: Tue Jan 06, 2004 11:14 pm
by techjunkie
Hmmm... I find this very strange...

Code: Select all

For a = 1 To 1000000000
Next
In BlitzBasic 4 seconds
In PureBasic 51 seconds

Code: Select all

a = 1
While a > 1000000000
a = a + 1
Wend
In BlitzBasic 2 seconds
In PureBasic 99 seconds

Why?!?! It's just empty loops... Don't get me wrong - I love PureBasic and like BlitzBasic (fill different needs), but why is it such a different in speed?

Posted: Tue Jan 06, 2004 11:21 pm
by Proteus
First loop is 3 seconds in purebasic here. (55 seconds with debugger enabled)
Second one only one second... Wow. (Seems to be just as fast with debugger on)

Did you have debugger enabled?

Posted: Tue Jan 06, 2004 11:29 pm
by techjunkie
Proteus wrote:First loop is 3 seconds in purebasic here. (55 seconds with debugger enabled)
Second one only one second... Wow. (Seems to be just as fast with debugger on)

Did you have debugger enabled?
Yeahhh :oops:

Sorry... Hehe... Now I got,

For Next loop - 2 for Pure, 4 for Blitz
While Wend loop - 2 for Pure, 2 for Blitz

Sorry - I'll made a mistake... Hehe... (Thinking of Fawlty Towers)

Re: Very strange... Speed for loops PureBasic vs BlitzBasic

Posted: Tue Jan 06, 2004 11:30 pm
by tinman
techjunkie wrote:Why?!?! It's just empty loops... Don't get me wrong - I love PureBasic and like BlitzBasic (fill different needs), but why is it such a different in speed?
Because you have the debugger on? Because pointless benchmarks like those can be massivly skewed by even the slightest difference? Because PB's optimiser isn't as good as BB's? Because neither have an optimiser clever enough to remove pointless loops? You also don't show how you timed the code - at least provide the full code so people can repeat your tests if they want.

For the record, your first code took 7.5 seconds from PB and 8.4 seconds from BB (BB2D v1.68 demo - yes, I know not up-to-date) to run on my Duron 750 while playing MP3's and running all the crap I usually do (PB, Mozilla, IRC, Office, Word, various explorer windows, etc).

Edit: Damn, I was too slow ;p

Posted: Tue Jan 06, 2004 11:39 pm
by Hi-Toro
Well, the second example is buggy -- it should be 'While a <' and not 'While a >', of course!

Both take roughly the same time here with debug off, but it's really quite a useless speed comparison to iterate through x blank loops anyway!

Re: Very strange... Speed for loops PureBasic vs BlitzBasic

Posted: Tue Jan 06, 2004 11:41 pm
by techjunkie
tinman wrote: But doesn't that give you some idea that pointless benchmarks are just...pointless?
Maybe this "benchmark", but I don't agree with you in general... For example - when you code in Ada for an aircraft and for specific hardware, you really have to count every cycle and you even do binary "diffs"... and check all the code the compiler generates...

So i think benchmarks really can be very important... for optimizion purpose...

I was just suprised by the differens between Pure and Blitz and asumed that I had forgot something... as I had... :roll:

Posted: Tue Jan 06, 2004 11:42 pm
by techjunkie
Hi-Toro wrote:Well, the second example is buggy -- it should be 'While a <' and not 'While a >', of course!

Both take roughly the same time here with debug off, but it's really quite a useless speed comparison to iterate through x blank loops anyway!
Yeah - of course... I didn't cut and paste the code... Sorry...

Posted: Tue Jan 06, 2004 11:50 pm
by Hi-Toro
Hey, no need for apologies -- I was just saying! :)

Re: Very strange... Speed for loops PureBasic vs BlitzBasic

Posted: Wed Jan 07, 2004 9:38 am
by tinman
techjunkie wrote:
tinman wrote: But doesn't that give you some idea that pointless benchmarks are just...pointless?
Maybe this "benchmark", but I don't agree with you in general...
OK, but it really was just this benchmark I was talking about when I meant pointless benchmarks :) It's just that there always seem to be a few "benchmarks" appear at the same time which compare PB to VB/BB/VC/blahblah and nearly all of them use code which doesn't really indicate much about any of the languages, especially when you consider the platform and purpose that much of them will be used for.

I know the pain of reading through assembly output from compilers to calculate the exact cycle time a sequence of instructions takes :)