Very strange... Speed for loops PureBasic vs BlitzBasic

Everything else that doesn't fall into one of the other PB categories.
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Very strange... Speed for loops PureBasic vs BlitzBasic

Post 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?
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Proteus
Enthusiast
Enthusiast
Posts: 113
Joined: Wed Sep 17, 2003 8:04 pm
Location: The Netherlands

Post 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?
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post 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)
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

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

Post 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
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
Hi-Toro
Enthusiast
Enthusiast
Posts: 270
Joined: Sat Apr 26, 2003 3:23 pm

Post 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!
James Boyd
http://www.hi-toro.com/
Death to the Pixies!
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

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

Post 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:
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post 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...
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Hi-Toro
Enthusiast
Enthusiast
Posts: 270
Joined: Sat Apr 26, 2003 3:23 pm

Post by Hi-Toro »

Hey, no need for apologies -- I was just saying! :)
James Boyd
http://www.hi-toro.com/
Death to the Pixies!
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

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

Post 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 :)
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
Post Reply