Thanks, Jan-Pieter, that's exactly what I was looking for.
What I am taking from that is that J (beta-o) runs this JTRAN code about 10% slower than the corresponding Python, and is quite a bit faster than previous J versions. Right?
Henry Rich On 9/6/2021 9:49 AM, Jan-Pieter Jacobs wrote:
Hi, I converted one of the BenchmarkGame problem's python solution ( https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/fannkuchredux.html) to J. I just transliterated the Python solution (including all the stinking loops, ugly workarounds for generators etc), sticking to the original as much as possible, so I am sure a faster solution must exist in J, and I also did not implement the parallel part of the python solution once arguments get large: this solution works till permutations of length 8. This is mainly because I wrote this on my phone and neither J's nor Python's parallelism is supported on my OS. The scripts used are in attachment (strip the .txt from the names) Results (abbreviated output; ran in powershell on Windows 10 on an Intel core i7-8665U): PS C:\Users\myuser\j903-user\temp> Measure-Command { For($i=0; $i -lt 100; $i++) {..\..\j903\bin\jconsole.exe fannkuch-redux_noai.ijs 8}} TotalMilliseconds : 53978,1287 PS C:\Users\myuser\j903-user\temp> Measure-Command { For($i=0; $i -lt 100; $i++) {python fannkuch-redux.py 8}} TotalMilliseconds : 50086,8826 PS C:\Users\myuser\j903-user\temp> python --version Python 3.8.3 PS C:\Users\myuser\j903-user\temp> ..\..\j903\bin\jconsole.exe -js 'exit 0: echo JVERSION' Engine: j903/j64avx2/windows Beta-o: commercial/2021-08-24T18:57:03 Library: 9.03.06 Platform: Win 64 Installer: J903 install InstallPath: c:/users/myuser/j903 Contact: www.jsoftware.com 100 * 53978.1287 % 50086.8826 107.769 Jconsole takes 7.8% longer than Python averaged over 100 runs. Which is quite good, I think, when compared with j903-beta a (most recent available for my phone, Android 32 (armeabi-v7a)) and python 3.9.6; there 50 runs of J took 2m19.879s vs. python 0m49.456s. That is, J takes 182.8% longer than Python, averaged over 50 runs! I'm also curious to see how the best J solution ranks compared to the above, as well as the paralnel version. Best regards, Jan-Pieter On Sun, Aug 29, 2021, 04:59 Henry Rich <[email protected]> wrote:In beta-o I have rewritten the parser one more time. I don't see how it can get much faster. In a weakly-typed language like J there is only so much analysis that can be done before executing a sentence. I wonder how J performs compared to other popular languages, especially Python which is what the cool kids are using. If anyone is willing to do the comparison, I'd be obliged. I am thinking of measuring the execution time of a simple program, one that does scalar-only operations so we are focusing on the parser. A sample J program would be: v =: {{ totl =. 0 for_i. y do. totl =. totl + i * i_index end. totl }} 10 (6!:2) 'v a' [ a =. i. 1e6 Large improvement would require heroic intervention: parsing & caching sentences on the fly & watching assignments to make sure the cached parse is valid. I would rather avoid that. Henry Rich -- This email has been checked for viruses by AVG. https://www.avg.com ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
-- This email has been checked for viruses by AVG. https://www.avg.com ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
