Page 2 of 2

Re: Speed of Pure & Spider comparsion

Posted: Fri Jun 15, 2018 2:07 pm
by StarBootics
The original test on my computer with DisableDebugger and compiling without the debugger give me 9.695 seconds
The User_Russian's test with DisableDebugger and compiling without the debugger give me 4.406 seconds
The NicTheQuick's test with DisableDebugger and compiling without the debugger give me 0.260 seconds

Best regards
StarBootics

Re: Speed of Pure & Spider comparsion

Posted: Fri Jun 15, 2018 2:50 pm
by marc_256
Hi,

I did some tests,
but I do not understand the results ?
I use PB 5.62 Final x64 on my old programming laptop ... I like this PC
If I start the program and check the taskmanager,
I see that PB is only using 23% of cpu time even when there is a lot of idle time ?

Why ?

Marc,

Re: Speed of Pure & Spider comparsion

Posted: Fri Jun 15, 2018 2:57 pm
by Bitblazer
marc_256 wrote:Hi,

I did some tests,
but I do not understand the results ?
I use PB 5.62 Final x64 on my old programming laptop ... I like this PC
If I start the program and check the taskmanager,
I see that PB is only using 23% of cpu time even when there is a lot of idle time ?

Why ?

Marc,
Sounds like a quadcore CPU with a software which utilitizes a single thread only. 3 of 4 cores cant participate so 25% would be the maximum you could get in the summary display. Switch do show each single core in a graph and see :)

Re: Speed of Pure & Spider comparsion

Posted: Fri Jun 15, 2018 3:12 pm
by Trond
The original code without the debugger (DisableDebugger shouldn't have an effect in this case):
13 758 ms

The original code, with the debugger and DisableDebugger:
13 916 ms

There is a small, but consistent difference. In other scenarios, there are actually big differences, especially when calling PB commands. When the debugger is turned off from the menu, the optimizer is turned on in the compiler (I think), and the library commands behave differently.

With debugger:
107 001 ms

Re: Speed of Pure & Spider comparsion

Posted: Fri Jun 15, 2018 4:32 pm
by djes
Bitblazer wrote:
marc_256 wrote:Hi,

I did some tests,
but I do not understand the results ?
I use PB 5.62 Final x64 on my old programming laptop ... I like this PC
If I start the program and check the taskmanager,
I see that PB is only using 23% of cpu time even when there is a lot of idle time ?

Why ?

Marc,
Sounds like a quadcore CPU with a software which utilitizes a single thread only. 3 of 4 cores cant participate so 25% would be the maximum you could get in the summary display. Switch do show each single core in a graph and see :)
Maybe it's also the reason why JavaScript could be faster than a compiled program, parts of the js code being executed on different cores. Threading is then very important...

Re: Speed of Pure & Spider comparsion

Posted: Sat Jun 16, 2018 10:54 am
by the.weavster
Kiffi wrote:That makes me sceptical:
Yes, it would be interesting to see the JS code. JavaScript compilers use inference engines that ascertain the datatype of a variable when it's initialized. If you take FireFox for example, iirc there are three levels of execution:

Interpreter (Functions that are only run once)
Baseline compiler (Warm code - A quick compile to byte code)
IonMonkey compiler (Hot code - A further more optimized compile generated from the byte code of Baseline)

If you change the datatype of a variable in JS that's running in FireFox it can slow down execution a lot because that routine will get kicked back down to the interpreter even if it's hot code (i.e. a routine that's being called repeatedly during execution). SpiderBasic's type checking should prevent developers from falling into that trap.

Re: Speed of Pure & Spider comparsion

Posted: Sat Jun 16, 2018 11:36 am
by the.weavster
NicTheQuick wrote:It is impossible that Spiderbasic is faster than Go, C, C++, C# except your coding is bad.
I'm not saying it's the case in this instance but when Mozilla were experimenting with asm.js it did outperform C++ on a Binary Trees benchmark.

Details here

Re: Speed of Pure & Spider comparsion

Posted: Sat Jun 16, 2018 2:17 pm
by firace
Original code took 19s here (with debugger disabled from the menu).

Could you post the SpiderBasic code too?

Your test results are very surprising (Java and Go faster than C++??)

Note: Nicthequick's version completed in 0.2s.

Re: Speed of Pure & Spider comparsion

Posted: Mon Jun 18, 2018 8:26 am
by zxretrosoft
firace wrote:Could you post the SpiderBasic code too?
Yes, of course...

Code: Select all

Global p.i
Global x.i=-1
Global a1.i,a2.i,a3.i
Global ps1.s,ps2.s,ps3.s
Global h1.s,h2.s,h3.s
Global h.i

Declare RenderFrame()

h1="L"
h2="W"
h3="K"
h=3724

RenderFrame()

Procedure RenderFrame()
  
 Repeat
  
x+1
p+1

If x>9999
    x=0
    a3+1
    If a3>25
        a3=0
        a2+1
        If a2>25
            a2=0
            a1+1
        EndIf
    EndIf
EndIf

Select a1
    Case 0
        ps1="A"
    Case 1
        ps1="B"
    Case 2
        ps1="C"
    Case 3
        ps1="D"
    Case 4
        ps1="E"
    Case 5
        ps1="F"
    Case 6
        ps1="G"
    Case 7
        ps1="H"
    Case 8
        ps1="I"
    Case 9
        ps1="J"
    Case 10
        ps1="K"
    Case 11
        ps1="L"
    Case 12
        ps1="M"
    Case 13
        ps1="N"
    Case 14
        ps1="O"
    Case 15
        ps1="P"
    Case 16
        ps1="Q"
    Case 17
        ps1="R"
    Case 18
        ps1="S"
    Case 19
        ps1="T"
    Case 20
        ps1="U"
    Case 21
        ps1="V"
    Case 22
        ps1="W"
    Case 23
        ps1="X"
    Case 24
        ps1="Y"
    Case 25
        ps1="Z"
EndSelect

Select a2
    Case 0
        ps2="A"
    Case 1
        ps2="B"
    Case 2
        ps2="C"
    Case 3
        ps2="D"
    Case 4
        ps2="E"
    Case 5
        ps2="F"
    Case 6
        ps2="G"
    Case 7
        ps2="H"
    Case 8
        ps2="I"
    Case 9
        ps2="J"
    Case 10
        ps2="K"
    Case 11
        ps2="L"
    Case 12
        ps2="M"
    Case 13
        ps2="N"
    Case 14
        ps2="O"
    Case 15
        ps2="P"
    Case 16
        ps2="Q"
    Case 17
        ps2="R"
    Case 18
        ps2="S"
    Case 19
        ps2="T"
    Case 20
        ps2="U"
    Case 21
        ps2="V"
    Case 22
        ps2="W"
    Case 23
        ps2="X"
    Case 24
        ps2="Y"
    Case 25
        ps2="Z"
EndSelect

Select a3
    Case 0
        ps3="A"
    Case 1
        ps3="B"
    Case 2
        ps3="C"
    Case 3
        ps3="D"
    Case 4
        ps3="E"
    Case 5
        ps3="F"
    Case 6
        ps3="G"
    Case 7
        ps3="H"
    Case 8
        ps3="I"
    Case 9
        ps3="J"
    Case 10
        ps3="K"
    Case 11
        ps3="L"
    Case 12
        ps3="M"
    Case 13
        ps3="N"
    Case 14
        ps3="O"
    Case 15
        ps3="P"
    Case 16
        ps3="Q"
    Case 17
        ps3="R"
    Case 18
        ps3="S"
    Case 19
        ps3="T"
    Case 20
        ps3="U"
    Case 21
        ps3="V"
    Case 22
        ps3="W"
    Case 23
        ps3="X"
    Case 24
        ps3="Y"
    Case 25
        ps3="Z"
EndSelect


Until h1=ps1 And h2=ps2 And h3=ps3 And h=x


Debug(p)


EndProcedure

Re: Speed of Pure & Spider comparsion

Posted: Mon Jun 18, 2018 5:59 pm
by firace
I confirm, SpiderBasic completes it in about 2 seconds.
Really surprising.

@Fred, if you could comment on this, it would be great :)


PS: I'm using Google Chrome on Win 10 x64.

Re: Speed of Pure & Spider comparsion

Posted: Tue Jun 19, 2018 6:49 am
by Cyllceaux
sounds like the string-"problem"
viewtopic.php?f=3&t=58892