I cannot run j9xx on my current desktop so I attempted to compare using
j807.
My comparison is much simpler than *Jan-Pieter*'s but it may be an
alternative.

I don't know much python, but one of the answers at the following link
suggested the simple instruction far below with the attached file. (To use
the file you must remove the .txt extension.)

https://stackoverflow.com/questions/1557571/how-do-i-get-time-of-a-python-programs-execution


   v =: monad define
totl =. 0
for_i. y
do. totl =. totl + i * i_index
end.
totl
)
   10 (6!:2) 'v a' [ a =. i. 1e6
0.768372
   1e6
1000000
   v a
333332833333500000
   JVERSION
Engine: j807/j64/darwin
Release-c: commercial/2019-02-24T10:50:40
Library: 8.07.26
Platform: Darwin 64
Installer: J807 install
InstallPath: /users/brian/j64-807
Contact: www.jsoftware.com

server:~ brian$ time python main.py
333332833333500000

real 0m0.855s
user 0m0.397s
sys 0m0.048s
server:~ brian$

My best guess is that the comparable timing is the "user" timing, but I am
guessing.
If so, that means that on my desktop 0.768372 for j compares with 0.397 for
python, which is in the ballpark with your much more relevant comparison.
On the other hand if the correct comparable timing is "sys" than that's
quite different.


-- 
(B=)
totl = 0
index=0
a = range(1000000)
for ai in a:
   totl = totl + ai*index
   index = index + 1
print totl
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to