1. There is wip wasm simd; I think firefox/chrome support it; if used, it
would probably make everything faster.
2. The goal of wasm is to make for faster tight loops than js. It is slower
at dynamic dispatch and pointer chasing than js, and slower than native c in
all three respects. But due to its purpose, future improvements on the part
of the browsers are likely to target tight loops; and je performance is mostly
down to tight loops, not so much pointer chasing and dispatch.
3. https://www.usenix.org/system/files/atc19-jangda.pdf contains a much richer
assessment of wasm performance than '2x'.
4. I don't think it's necessary for a j playground hosted in a web browser to
be particularly fast. It's never going to be as fast as native anyway. I
agree with Joe and Henry: only 2x slower is a nice surprise, and even (say)
10x slower would not be inadequate.
On Mon, 16 May 2022, Joe Bogner wrote:
Neat example and nice demo of the playground (prototype version).
I haven't done much performance testing on the playground. I was expecting
the playground to be a large order of magnitude slower than J904. I was
pleasantly surprised to this example is 2x slower on the playground, which
is in line with what the emscripten website says (noted below)
On my machine:
JVERSION
Engine: j904/j64avx2/windows
Beta-a: commercial/2022-04-09T17:57:22
Library: 9.04.01
Qt IDE: 2.0.3/6.2.4(6.2.4)
Platform: Win 64
Installer: J904 install
InstallPath: c:/users/joebogner/downloads/j904
Contact: www.jsoftware.com
(6!:2) 'plot bspir 10000'
0.253758
vs the playground
Google Chrome 96.0.4664.110 (Official Build) (64-bit) (cohort: Stable)
Revision d5ef0e8214bc14c9b5bbf69a1515e431394c62a6-refs/branch-heads/4664@
{#1283}
OS Windows 10 Version 20H2 (Build 19042.1415)
JavaScript V8 9.6.180.21
(6!:2) 'plot bspir 10000'
0.507
From emscripten: https://emscripten.org/docs/optimizing/Optimizing-Code.html
"Emscripten-compiled code can currently achieve approximately half the
speed of a native build. If the performance is significantly poorer than
expected, you can also run through the additional troubleshooting steps
below:"
"Generally you should first compile and run your code without optimizations
(the default). Once you are sure that the code runs correctly, you can use
the techniques in this article to make it load and run faster."
I tried compiling with -O3 (
https://github.com/jsoftware/j-playground/blob/j903_wasm/jsrc/makefile.html#L7)
and it didn't make any appreciable difference
So, I went back to the default options of emscripten while we continue to
focus on correctness. My guess is that any speedup will come from J code
and not tweaks to the C->JS compilation (emscripten) since it seems to be
in line with general emscripten expectations.
Are you seeing drastically different times on your machine?
On Mon, May 16, 2022 at 8:12 PM Raul Miller <rauldmil...@gmail.com> wrote:
https://rosettacode.org/wiki/Babylonian_spiral
The online J version is significantly slower than the online phix version.
Does anyone feel like working on this?
Thanks,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm