### Author Topic: Small benchmark...o2-PB-FB  (Read 1501 times)

0 Members and 1 Guest are viewing this topic.

#### Aurel

• Guest
##### Small benchmark...o2-PB-FB
« 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
« Last Edit: May 03, 2020, 09:27:52 pm by Aurel »

#### Brian Alvarez

• Hero Member
• Posts: 699
##### Re: Small benchmark...o2-PB-FB
« Reply #1 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.
« Last Edit: May 03, 2020, 05:31:21 pm by Brian Alvarez »

#### Aurel

• Guest
##### Re: Small benchmark...o2-PB-FB
« Reply #2 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

#### Brian Alvarez

• Hero Member
• Posts: 699
##### Re: Small benchmark...o2-PB-FB
« Reply #3 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

#### Aurel

• Guest
##### Re: Small benchmark...o2-PB-FB
« Reply #4 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

#### Brian Alvarez

• Hero Member
• Posts: 699
##### Re: Small benchmark...o2-PB-FB
« Reply #5 on: May 05, 2020, 08:02:50 am »
Compiled it for Java...  0.2900 seconds.

#### Aurel

• Guest
##### Re: Small benchmark...o2-PB-FB
« Reply #6 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.