bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Fun With Benchmarks


From: Elias Mårtenson
Subject: Re: [Bug-apl] Fun With Benchmarks
Date: Sat, 22 Aug 2015 12:26:53 +0800

Interesting. I have a feeling that the majority of the time taken is in copying the arrays prior to every operation. I'll run it using cachegrind tonight to see if I'm right.

Regards,
Elias

On 22 Aug 2015 12:24, "Mike Duvos" <address@hidden> wrote:
One more little benchmark, this time doing a variety of primitives.

      ⎕IO←0

     ∇
[0]   TIME X;TS
[1]   TS←⎕TS
[2]   ⍎X
[3]   (⍕(24 60 60 1000⊥¯4↑⎕TS-TS)÷1000),' Seconds.'
    ∇

    ∇
[0]   Z←SHOW X;I
[1]   Z←(I,50)⍴(50×I←⌈(⍴X)÷50)↑X←,X
    ∇

    ∇
[0]   Z←X TIMES Y;D;I;C
[1]   Z←+⌿(-⍳⍴X)⌽Z←((⍴X),(⍴X)+⍴Y)↑Z←(D⍳X←⌽,X)∘.×(D←'0123456789')⍳Y←⌽,Y
[2]   I←¯1◊C←0
[3]  L1:→((I←I+1)⍴Z)/L2
[4]   C←⌊(÷10)×Z[I]←Z[I]+C
[5]   Z[I]←10|Z[I]
[6]   →L1
[7]  L2:Z←((¯1+⍴Z)⌊+/∧\'0'=Z)↓Z←D[⌽Z]
    ∇

    ∇
[0]   Z←FACTORIAL N;I
[1]   Z←,'1'◊I←1
[2]  L1:→((I←I+1)>N)/0
[3]   Z←Z TIMES⍕I
[4]   →L1
    ∇

[IBM APL2]

      TIME 'SHOW FACTORIAL 300'
30605751221644063603537046129726862938858880417357
69994167767412594765331767168674655152914224775733
49939147888701726368864263907759003154226842927906
97455984122547693027195460400801221577625217685425
59653569035067887252643218962642993652045764488303
88909753943489625436053225980776521270822437639449
12012867867536830571229368194364995646049816645022
77165001851765464693401122260347297240663332585835
06870150169794168850353752137554910289126407157154
83028228493795263658014523523315693648223343679925
45940952768206080622328123873838808170496000000000
00000000000000000000000000000000000000000000000000
000000000000000                                  
2.078 Seconds.

[GNU APL]

      TIME 'SHOW FACTORIAL 300'
30605751221644063603537046129726862938858880417357
69994167767412594765331767168674655152914224775733
49939147888701726368864263907759003154226842927906
97455984122547693027195460400801221577625217685425
59653569035067887252643218962642993652045764488303
88909753943489625436053225980776521270822437639449
12012867867536830571229368194364995646049816645022
77165001851765464693401122260347297240663332585835
06870150169794168850353752137554910289126407157154
83028228493795263658014523523315693648223343679925
45940952768206080622328123873838808170496000000000
00000000000000000000000000000000000000000000000000
000000000000000                                  
52.547 Seconds.

I see these numbers, ~2 seconds and  ~52 seconds a lot, so I will conclude object-oriented APL is about 25 times as slow as fine-tuned machine language APL.  Not too bad a penalty for portability across a wide spectrum of CPU architectures and Operating Systems.

With modern commodity processors doing billion of instructions per second, most people probably won't even notice.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]