April 19, 2024, 01:42:56 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Speed of Creative Basic

Started by TexasPete, November 04, 2008, 10:02:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TexasPete

I know that Creative basic is an interpreted language. But, I was curious to see some simple speed comparisions between creative basic and Liberty basic.
As I get familiar with ebasic and cbasic, I am aware that both are more powerful and lb. I tried to do a simple for next loop using a simple timer.
I am a little confused about the cbasic timer. could
some one show me a simple example.

Thanks
Texas Pete

GWS

Hi Pete .. timing comparisons are not very meaningful - it depends on the type of processing being done.

It might be mainly logical statements, or graphics, or file handling .. it's a bit like asking what's the performance of a Rolls Royce  - to which they always answered -adequate ..  :)

Anyway, here's a very simple run of 10 million loop operations, which took 7000 millisecs on my machine.

I used the system timer GetTickCount() which I think is supposed to be a bit more precise.


openconsole
cls

Declare "kernel32", GetTickCount(),int

start = GetTickCount()

' empty loop 10 million times ..
for i = 1 to 10000000
next i

time = GetTickCount() - start

print time

do:until inkey$<>""
closeconsole
end


all the best, :)

Graham
Tomorrow may be too late ..

GWS

November 04, 2008, 11:59:30 AM #2 Last Edit: November 05, 2008, 01:30:25 AM by GWS
Here's another test dating back to 2004 when Paul discussed the issue.

First Creative Code:


DIM Flags[8191],K,I AS INT
SETPRECISION 6
PRINT "SIEVE OF ERATOSTHENES - 1000 iterations"
PRINT "Best to go get a cup of tea, and maybe a sandwich while waiting"
DECLARE "kernel32",MILLISECS ALIAS GetTickCount(),INT
X = MILLISECS()
FOR Iter = 1 TO 1000
  Count = 0
  FOR I = 0 TO 8190
    Flags[I] = 1
  NEXT I
  FOR I = 0 TO 8190
    IF Flags[I]=1
       Prime = I + I
       Prime = Prime + 3
       K = I + Prime
       WHILE K <= 8190
         Flags[K] = 0
         K = K + Prime
       ENDWHILE
       Count = Count + 1
    ENDIF
  NEXT I
NEXT Iter
X = MILLISECS() - X
PRINT "1000 iterations took ", X/1000.0, " seconds."
PRINT Count
DO:UNTIL INKEY$ <> ""
END



This took 176.157 seconds on my machine ..  :o

Here's the corresponding EBasic code:


DIM Flags[8191] AS INT
SETPRECISION 6
PRINT "SIEVE OF ERATOSTHENES - 1000 iterations"
X = MILLISECS()
FOR Iter = 1 TO 1000
  Count = 0
  FOR I = 0 TO 8190
    Flags[I] = 1
  NEXT I
  FOR I = 0 TO 8190
    IF Flags[I]=1 THEN
       Prime = I + I
       Prime = Prime + 3
       K = I + Prime
       WHILE K <= 8190
         Flags[K] = 0
         K = K + Prime
       ENDWHILE
       Count = Count + 1
    ENDIF
  NEXT I
NEXT Iter
X = MILLISECS() - X
PRINT "1000 iterations took ", X/1000.0, " seconds."
PRINT "Primes: ",Count
DO:UNTIL INKEY$ <> ""
END



I haven't run this, but back then some folk got 0.391 seconds for EBasic (IBPro as it was then) - a huge difference, but then it's not fair comparing a compiled program with an interpreted one ..  :)  You'll have to wait 'til Paul gets round to adding the compile facility to Creative ..

Some other comments from the old discussion ..

"There is no truly accurate speed test when comparing langauges. At least not a good overall one for compiled languages. Processor dependancy is a problem I prefer and use mostly AMD chips that the benchmark was only .1 difference between another language and Pro.

However the results would vary greatly if say both were run on a P4 with hyperthreading. Depending on when you ran it with system load.

C is slower than IBasic Pro on integer operations but is faster on double precision values in some cases.

Pro is faster than other languages for hit testing sprites because it was a specific requirement of the language pack by Idigicon. So was the speed of the WritePixelFast command that I spend many hours tweaking in low level assembly.

So the only real test is by application on a case by case basis.  Paul."

all the best, :)

Graham
Tomorrow may be too late ..

TexasPete

Dear Graham,

I ran a comparision, of the same number of for next loops
Comparing Liberty Basic and Creative Basic.

On my computer Liberty basic took 35250 Milliseconds to complete the loop.

Creative Basic Did the same number of loops in 9469.  It appears that Creative basic is 3.72 timers faster than
Liberty Basic.

Texas Pete

GWS

Yep .. for that particular test it seems so.

I've run it on EBasic and get 31 msec .. which again seems to show the compiled program is more than 200 times faster ..  ::)

But then. it seems to me to be more useful to enquire what a language is capable of doing in a 'reasonable' time.
That's why I post as many different applications as I can to show what is possible.

Obviously, if your application is to plot a course to the moon - then you wouldn't use an interpreter language ..  :)

all the best,

Graham
Tomorrow may be too late ..

Duffer

FWIW, years ago, I did a speed test betweem the old IBasic and LB.  LB took over three seconds and IB took 2 ms.

LB is habitually the slowest language available for Windows and has runtimes that are larger than VB 6's, not to mention that LB does NOT work properly on XP SP2 or above and does NOT work properly on modern hardware.

CB blows LB away.

LarryMc

I owned LB way back and trashed it instantly when I found and bought IBPro. 
IBPro was faster, and for me, much more intuitive and easy to use.
I wouldn't trade my Paul Turley products for anything.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

TexasPete

Thanks Everybody,
I expected cb and eb to be faster than lb. I have been in the throws of changing over totally. I can do more with greater ease and it is simply faster.
I hope that all of us can contiue to support Paul. His language truly does deserve the effort of our support. There is certainly a large enough market out their to
support all the languages. I think however, that paul's needs and deserves all the extra effort that we can give him. Liberty basic already has enough support.Let's
help the smaller companies when they deserve it.

Thanks all
Texas Pete

REDEBOLT

You have to consider that Liberty Basic is an interpreter that is written in Smalltalk, which is another interpreter.  So you have two levels of interpretation going on.  But, you have to consider the application.  If it is not time-critical, such as a data entry screen, then a two-second response time would be satisfactory.  Then, too, with computers having multiple gigaherz times and multiple processors, response times would be unnoticable.  But if you are cranking through mountains of data, such as that produced by CERN super-collider, you want those calculations to be as short and efficient as possible.
Regards,
Bob