Oxygen Basic

Programming => Example Code => Topic started by: Aurel on May 03, 2020, 11:37:54 AM

Title: Small benchmark...o2-PB-FB
Post by: Aurel on May 03, 2020, 11:37:54 AM
Oxygenbasic - 0.31 sec
Powerbasic   - 3.09 sec
FreeBasic ...  - 0.031 sec

Oxygen Basic:
Code: [Select]

'con cat strings in o2
$ filename "strSpeed.exe"
include "rtl32.inc"
Declare Function GetTickCount Lib "kernel32.dll" () As INT

DIM start AS int
DIM endx AS int
DIM strArray[100000] as string
start = GetTickCount()
string s = "test string"
DIM i AS int
FOR i = 1 TO 100000
   strArray = s
NEXT i

endx = GetTickCount()

 print "Current value  is: " + STR((endx-start)/1000)


Power Basic :
Code: [Select]

#COMPILE EXE
#DIM ALL
FUNCTION PBMAIN () AS LONG

DIM start AS DOUBLE
start = TIMER
DIM s AS STRING : s = "test string"
DIM sArr(100000) AS STRING
DIM i AS LONG
FOR i = 1 TO 100000
   sArr(i) = s
NEXT
DIM endx AS DOUBLE
endx = TIMER

  MSGBOX "Current value of X% is: " & STR$(endx-start)
END FUNCTION



Free Basic :

Code: [Select]

DIM start AS DOUBLE = timer
DIM sArr(100000) as string
DIM s AS STRING :  s = "test string"
FOR i as long  = 1 TO 100000
   sArr(i) = s   
NEXT
DIM endx AS DOUBLE = timer
print endx - start

print LEN(s)

SLEEP
Title: Re: Small benchmark...o2-PB-FB
Post by: Brian Alvarez on May 03, 2020, 03:48:47 PM
What are your computer specs? My PC is taking 0.016 to complete the task on PowerBASIC... with 1000000 items.
Title: Re: Small benchmark...o2-PB-FB
Post by: Aurel on May 03, 2020, 09:07:59 PM
And what is your computer spec?
and what is result for Oxygen ?

FB fix...

DIM start AS DOUBLE = timer
DIM SHARED sArr(100000) as string
DIM s AS STRING :  s = "test string"
FOR i as long  = 1 TO 100001
   sArr(i) = s   ' i get error that s need pointer ?
NEXT
DIM endx AS DOUBLE = timer
print endx - start

print LEN(s)

SLEEP

0.031 sec
Title: Re: Small benchmark...o2-PB-FB
Post by: Brian Alvarez on May 04, 2020, 07:08:55 AM
 I am testing on an i7-8700. 24Gb ram.

 most of the time the time taken is so small, that it doesnt even register: 0.0000

 I wonder why it takes 3 seconds on your system...

 By the way... same code compiled for PHP takes: 0.2269
not bad...
Title: Re: Small benchmark...o2-PB-FB
Post by: Aurel on May 04, 2020, 08:07:49 AM
my is old dual-core for win7...64bit
evan i use on it win7 32 bit most of time , i don't know why PB have the worst result in filling string array
and your computer is too strong for testing  ;D
Title: Re: Small benchmark...o2-PB-FB
Post by: Brian Alvarez on May 05, 2020, 08:02:50 AM
Compiled it for Java...  0.2900 seconds.
Title: Re: Small benchmark...o2-PB-FB
Post by: Aurel on May 05, 2020, 11:50:16 AM
I have java but i cannot remember when i use it last time ..
yes ..when i try to compile JImage interpreter...source code of this one is nice ,almost looks like basic.