Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Aug 21, 2017 10:58 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: RB Benchmark
PostPosted: Fri Feb 15, 2013 6:33 am 
Offline
User avatar

Joined: Fri Feb 15, 2013 6:07 am
Posts: 24
Location: Oran, Algeria
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Fri Feb 15, 2013 9:03 am 
Offline

Joined: Wed May 20, 2009 11:02 am
Posts: 423
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

_________________
Using RS2011r4.3 on Windows7.


Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Fri Feb 15, 2013 9:39 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
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

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Fri Feb 15, 2013 10:13 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
#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.

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Fri Feb 15, 2013 11:13 am 
Offline
User avatar

Joined: Mon Feb 05, 2007 5:21 pm
Posts: 600
Location: New York, NY
Change the declaration of i from UInt64 to Integer. Time here drops from 1.06 seconds to 0.62 seconds.

_________________
Kem Tekinay
MacTechnologies Consulting
http://www.mactechnologies.com/

Need to develop, test, and refine regular expressions? Try RegExRX.


Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Fri Feb 15, 2013 11:57 am 
Offline
User avatar

Joined: Sun Jan 25, 2009 5:11 pm
Posts: 576
Location: Guatemala, Central America
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:

_________________
Future RS guru.
Ride the world!


Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Fri Feb 15, 2013 2:14 pm 
Offline

Joined: Wed Mar 22, 2006 11:15 am
Posts: 712
Location: Southern California
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.

_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/


Last edited by taylor-design on Fri Feb 15, 2013 3:23 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Fri Feb 15, 2013 2:22 pm 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
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 :)

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Fri Feb 15, 2013 2:26 pm 
Offline
User avatar

Joined: Fri Feb 15, 2013 6:07 am
Posts: 24
Location: Oran, Algeria
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Fri Feb 15, 2013 8:18 pm 
Offline
User avatar

Joined: Sun Jan 25, 2009 5:11 pm
Posts: 576
Location: Guatemala, Central America
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.

_________________
Future RS guru.
Ride the world!


Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Sun Feb 17, 2013 3:20 am 
Offline
User avatar

Joined: Fri Feb 15, 2013 6:07 am
Posts: 24
Location: Oran, Algeria
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Sun Feb 17, 2013 9:17 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
use FORMAT not STR

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Sun Feb 17, 2013 2:57 pm 
Offline

Joined: Mon May 30, 2011 12:56 am
Posts: 702
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Tue Feb 19, 2013 5:57 am 
Offline
User avatar

Joined: Fri Feb 15, 2013 6:07 am
Posts: 24
Location: Oran, Algeria
DaveS wrote:
use FORMAT not STR


I have already used Format but i lose scientific notation.

Regards


Top
 Profile  
Reply with quote  
 Post subject: Re: RB Benchmark
PostPosted: Tue Feb 19, 2013 6:27 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
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

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group