Real Software Forums
http://forums.realsoftware.com/

RB Benchmark
http://forums.realsoftware.com/viewtopic.php?f=13&t=46953
Page 1 of 3

Author:  Djamel [ Fri Feb 15, 2013 6:33 am ]
Post subject:  RB Benchmark

Hello,
Coming from VB6, i decide to migrate to RealBasic, i have already installed RB 2012 in my computer.
Intel Core 2 CPU, 4300@1.8Ghz, 2Gb RAM - OS Windows XP Pack 2.
I have made this test under desktop project as follow:


VB6 code
Dim x As Double
Dim y As Double
Dim i As Long
Dim t As Single
x = 1
y = 1.000001
t = Timer

For i = 1 To 100000000
x = x * y
Next

t = Timer - t
Print "x: "; x
Print "t: "; t


Result under VB6 X= 2.68798271729777E+43 -- Time= 2.9 Sec after compiling, Time=1.85 Sec
Result under Borland C/C++, X= 2.68798271729777E+43 -- Time= 0.65 Sec with C compiler.
Result under RB 2012, X= 2.68798271729777E+43 -- Time= 3.5 Sec

It seams that Vb6 faster then RealBasic !

Any body can explain me the difference ?
Regards.

Author:  pixe656 [ Fri Feb 15, 2013 9:03 am ]
Post subject:  Re: RB Benchmark

Just to clarify, have you compiled the RB code too?

Could you show the actual RB code too?

If you go on with RS, there is a known memory issue with the IDE on Windows XP. Windows 7 would be a better choice as a development machine. This has nothing to do with the lower speed you are reporting, though.

Pixe

Author:  MonkeybreadSoftware [ Fri Feb 15, 2013 9:39 am ]
Post subject:  Re: RB Benchmark

please put a

#pragma BackgroundTasks False

first on the top of this test method.

Than build and test again.
(not in debug mode, please)

While RB is not so fast as C, it may still be fast enough.

Greetings
Christian

Author:  DaveS [ Fri Feb 15, 2013 10:13 am ]
Post subject:  Re: RB Benchmark

#pragma BackgroundTasks False

Dim x As Double
Dim y As Double
Dim i As uint64
Dim t As double
x = 1
y = 1.000001
t = Microseconds

For i = 1 To 100000000
x = x * y
Next

t = (microseconds - t)/1000000
msgbox "X="+str(x)+" T="+format(t,"#0.0000000")


On my machine... 9.5 seconds run in the IDE, but only 1.3 seconds compiled
This is under OSX... so I can't compare it to VB6... plus my machine may be quite different performance wise from the one in the OP

but above is the RS equivalent of the posted VB6 code.


BTW... This is not a very good "benchmark"..... don't rate RS vs VB on sole this.

and remember.. VB6 is dead (according to microsoft), while RS is alive, and moving forward.

Author:  ktekinay [ Fri Feb 15, 2013 11:13 am ]
Post subject:  Re: RB Benchmark

Change the declaration of i from UInt64 to Integer. Time here drops from 1.06 seconds to 0.62 seconds.

Author:  HMARROQUINC [ Fri Feb 15, 2013 11:57 am ]
Post subject:  Re: RB Benchmark

Compiled and changing Dim i As uint64 to Integer on this semi-dinosaur of a machine (Core Duo 2.0GHz, 4 GB Ram, Windows 7 Ultimate 64 bit and playing Sultans of Swing in the background) the result is 0.973 seconds. Running from the IDE it's on average 8.5 secs.

Apples to apples my friend.

P.S. My machine is faster than Dave's :lol:

Author:  taylor-design [ Fri Feb 15, 2013 2:14 pm ]
Post subject:  Re: RB Benchmark

MonkeybreadSoftware wrote:
please put a

#pragma BackgroundTasks False

first on the top of this test method.


A little background for VB6 users...RS has built in cooperative threading, so code which loops yields time to the main thread and any other threads running in the background. The pragma above temporarily turns this off.

RS chose a cooperative model for Realbasic threading despite its drawbacks because cooperative threads are far easier to code, test, and debug than preemptive threads.

Author:  DaveS [ Fri Feb 15, 2013 2:22 pm ]
Post subject:  Re: RB Benchmark

HMARROQUINC wrote:
P.S. My machine is faster than Dave's :lol:


Yeah I got a dinosaur... but a powerful one still.... a 2006 MacPro... soon to be replaced with a 2013 iMac which benchmarks out like 2.5x faster

EDIT:
HA! actually MINE is faster :D

changing from UINT64 to INTEGER.. mine ran in 0.75 seconds :)

Author:  Djamel [ Fri Feb 15, 2013 2:26 pm ]
Post subject:  Re: RB Benchmark

Hello,
with
#pragma BackgroundTasks False above:

in IDE, result 9.7 sec instead of 11.9 sec
Compiled, gives 1.2 sec, better then Vb6!

Thank you.

Author:  HMARROQUINC [ Fri Feb 15, 2013 8:18 pm ]
Post subject:  Re: RB Benchmark

Djamel wrote:
Hello,
with
#pragma BackgroundTasks False above:

in IDE, result 9.7 sec instead of 11.9 sec
Compiled, gives 1.2 sec, better then Vb6!

Thank you.


When your code is not fast enough the solution is to spec a faster computer.

Author:  Djamel [ Sun Feb 17, 2013 3:20 am ]
Post subject:  Re: RB Benchmark

Hello,

msgbox "X="+str(x)+" T="+format(t,"#0.0000000")


Mantissa
Using str(x), we get X= 2.687983e+43 instead of X= 2.68798271729777E+43 with VB6 an C

How can i display a same mantissa as VB6 ?

Regards.

Author:  DaveS [ Sun Feb 17, 2013 9:17 am ]
Post subject:  Re: RB Benchmark

use FORMAT not STR

Author:  kermit [ Sun Feb 17, 2013 2:57 pm ]
Post subject:  Re: RB Benchmark

Quote:
When your code is not fast enough the solution is to spec a faster computer.


Ouch. But true..
This is why a Windows 3.1 installation could be backed-up up on a floppy disc,
and also why my 2.4Ghz with 4Gb RAM machines don't feel any faster than my 25Mhz 486 with 4Mb RAM did in 1992.

Author:  Djamel [ Tue Feb 19, 2013 5:57 am ]
Post subject:  Re: RB Benchmark

DaveS wrote:
use FORMAT not STR


I have already used Format but i lose scientific notation.

Regards

Author:  MonkeybreadSoftware [ Tue Feb 19, 2013 6:27 am ]
Post subject:  Re: RB Benchmark

Maybe you try FormatMBS in our plugins?

for example:

dim d as Double = 123.4567890
listbox1.AddRow FormatMBS("%f", d)
listbox1.AddRow FormatMBS("%e", d)
listbox1.AddRow FormatMBS("%g", d)

listbox1.AddRow FormatMBS("%5.5f", d)
listbox1.AddRow FormatMBS("%5.5e", d)
listbox1.AddRow FormatMBS("%5.5g", d)

d = 0.000000123456
listbox1.AddRow FormatMBS("%f", d)
listbox1.AddRow FormatMBS("%e", d)
listbox1.AddRow FormatMBS("%g", d)

listbox1.AddRow FormatMBS("%5.5f", d)
listbox1.AddRow FormatMBS("%5.5e", d)
listbox1.AddRow FormatMBS("%5.5g", d)

gives this output:

123.456789
1.234568e+02
123.457
123.45679
1.23457e+02
123.46
0.000000
1.234560e-07
1.23456e-07
0.00000
1.23456e-07
1.2346e-07

so you can have various styles.

Greetings
Christian

Page 1 of 3 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/