Skip to content

Commit 350067f

Browse files
committed
Add commands for Scala JS Wasm + update results
1 parent 08967ff commit 350067f

File tree

1 file changed

+87
-55
lines changed

1 file changed

+87
-55
lines changed

jsoniter-scala-examples/README.md

Lines changed: 87 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,28 @@ Expected output:
1818
```text
1919
Performance counter stats for './example01.jar' (100 runs):
2020
21-
286,59 msec task-clock # 1,985 CPUs utilized ( +- 0,82% )
22-
1 914 context-switches # 6,679 K/sec ( +- 1,44% )
23-
140 cpu-migrations # 488,508 /sec ( +- 7,96% )
24-
19 161 page-faults # 66,859 K/sec ( +- 0,18% )
25-
1 171 824 946 cycles # 4,089 GHz ( +- 0,49% )
26-
1 419 578 393 instructions # 1,21 insn per cycle ( +- 0,16% )
27-
281 308 247 branches # 981,581 M/sec ( +- 0,17% )
28-
9 408 222 branch-misses # 3,34% of all branches ( +- 0,24% )
29-
TopdownL1 # 11,4 % tma_backend_bound
30-
# 36,5 % tma_bad_speculation
31-
# 33,2 % tma_frontend_bound
32-
# 19,0 % tma_retiring ( +- 0,19% )
33-
34-
0,144400 +- 0,000766 seconds time elapsed ( +- 0,53% )
21+
175.84 msec task-clock # 1.593 CPUs utilized ( +- 0.21% )
22+
1,100 context-switches # 6.256 K/sec ( +- 0.83% )
23+
11 cpu-migrations # 62.556 /sec ( +- 2.06% )
24+
10,057 page-faults # 57.193 K/sec ( +- 0.04% )
25+
720,474,662 cycles # 4.097 GHz ( +- 0.17% )
26+
946,247,562 instructions # 1.31 insn per cycle ( +- 0.07% )
27+
183,694,120 branches # 1.045 G/sec ( +- 0.07% )
28+
7,111,513 branch-misses # 3.87% of all branches ( +- 0.08% )
29+
TopdownL1 # 13.9 % tma_backend_bound
30+
# 33.9 % tma_bad_speculation
31+
# 31.5 % tma_frontend_bound
32+
# 20.8 % tma_retiring ( +- 0.12% )
33+
34+
0.110362 +- 0.000163 seconds time elapsed ( +- 0.15% )
3535
```
3636

3737
### Build Scala JS output, print its size, and measure its start up time with `node`
3838

3939
```sh
4040
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
4141
source ~/.bashrc
42-
nvm install 16
42+
nvm install 22
4343
sudo sysctl kernel.perf_event_paranoid=1
4444
scala-cli --power package --js --js-mode release example01.sc --force -o example01.js
4545
ls -l ./example01.js
@@ -49,20 +49,52 @@ Expected output:
4949
```text
5050
Performance counter stats for 'node ./example01.js' (100 runs):
5151
52-
27,18 msec task-clock # 0,990 CPUs utilized ( +- 0,18% )
53-
22 context-switches # 809,497 /sec ( +- 5,66% )
54-
1 cpu-migrations # 36,795 /sec ( +- 10,70% )
55-
2 803 page-faults # 103,137 K/sec ( +- 0,03% )
56-
125 384 201 cycles # 4,614 GHz ( +- 0,16% )
57-
196 598 438 instructions # 1,57 insn per cycle ( +- 0,09% )
58-
34 031 877 branches # 1,252 G/sec ( +- 0,09% )
59-
1 247 743 branch-misses # 3,67% of all branches ( +- 0,05% )
60-
TopdownL1 # 12,8 % tma_backend_bound
61-
# 19,9 % tma_bad_speculation
62-
# 36,1 % tma_frontend_bound
63-
# 31,2 % tma_retiring ( +- 0,14% )
52+
21.58 msec task-clock # 0.996 CPUs utilized ( +- 0.16% )
53+
19 context-switches # 880.402 /sec ( +- 1.65% )
54+
0 cpu-migrations # 0.000 /sec
55+
2,705 page-faults # 125.341 K/sec ( +- 0.04% )
56+
94,278,347 cycles # 4.369 GHz ( +- 0.14% )
57+
168,171,694 instructions # 1.78 insn per cycle ( +- 0.01% )
58+
28,793,274 branches # 1.334 G/sec ( +- 0.02% )
59+
580,994 branch-misses # 2.02% of all branches ( +- 0.06% )
60+
TopdownL1 # 17.7 % tma_backend_bound
61+
# 14.4 % tma_bad_speculation
62+
# 31.8 % tma_frontend_bound
63+
# 36.2 % tma_retiring ( +- 0.14% )
6464
65-
0,027464 +- 0,000292 seconds time elapsed ( +- 1,06% )
65+
0.0216665 +- 0.0000338 seconds time elapsed ( +- 0.16% )
66+
```
67+
68+
### Build Scala JS Wasm output, print its size, and measure its start up time with `node`
69+
70+
```sh
71+
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
72+
source ~/.bashrc
73+
nvm install 22
74+
sudo sysctl kernel.perf_event_paranoid=1
75+
scala-cli --power package --js --js-mode release --js-emit-wasm --js-module-kind es --js-module-split-style fewestmodules example01.sc --force
76+
ls -l ./example01.js/
77+
perf stat -r 100 node --experimental-wasm-exnref ./example01.js/main.js > /dev/null
78+
```
79+
80+
Expected output:
81+
```text
82+
Performance counter stats for 'node --experimental-wasm-exnref ./example01.js/main.js' (100 runs):
83+
84+
33.51 msec task-clock # 0.997 CPUs utilized ( +- 0.15% )
85+
66 context-switches # 1.970 K/sec ( +- 0.44% )
86+
0 cpu-migrations # 0.000 /sec
87+
3,102 page-faults # 92.567 K/sec ( +- 0.04% )
88+
146,180,631 cycles # 4.362 GHz ( +- 0.13% )
89+
239,361,867 instructions # 1.64 insn per cycle ( +- 0.01% )
90+
41,631,362 branches # 1.242 G/sec ( +- 0.01% )
91+
1,112,970 branch-misses # 2.67% of all branches ( +- 0.04% )
92+
TopdownL1 # 14.6 % tma_backend_bound
93+
# 23.2 % tma_bad_speculation
94+
# 32.0 % tma_frontend_bound
95+
# 30.3 % tma_retiring ( +- 0.12% )
96+
97+
0.0336197 +- 0.0000488 seconds time elapsed ( +- 0.15% )
6698
```
6799

68100
### Build GraalVM native image, print its size, and measure its start up time
@@ -78,20 +110,20 @@ Expected output:
78110
```text
79111
Performance counter stats for './example01_graalvm.bin' (100 runs):
80112
81-
1,81 msec task-clock # 0,950 CPUs utilized ( +- 0,29% )
82-
1 context-switches # 551,909 /sec ( +- 5,14% )
83-
0 cpu-migrations # 0,000 /sec
84-
705 page-faults # 389,096 K/sec ( +- 0,01% )
85-
7 795 856 cycles # 4,303 GHz ( +- 0,32% )
86-
11 758 377 instructions # 1,51 insn per cycle ( +- 0,05% )
87-
2 299 367 branches # 1,269 G/sec ( +- 0,03% )
88-
22 831 branch-misses # 0,99% of all branches ( +- 0,71% )
89-
TopdownL1 # 27,8 % tma_backend_bound
90-
# 6,8 % tma_bad_speculation
91-
# 32,9 % tma_frontend_bound
92-
# 32,5 % tma_retiring ( +- 0,32% )
113+
2.02 msec task-clock # 0.945 CPUs utilized ( +- 0.49% )
114+
1 context-switches # 493.912 /sec ( +- 8.42% )
115+
0 cpu-migrations # 0.000 /sec
116+
706 page-faults # 348.702 K/sec ( +- 0.01% )
117+
8,343,057 cycles # 4.121 GHz ( +- 0.57% )
118+
11,631,591 instructions # 1.39 insn per cycle ( +- 0.04% )
119+
2,267,207 branches # 1.120 G/sec ( +- 0.03% )
120+
22,802 branch-misses # 1.01% of all branches ( +- 0.78% )
121+
TopdownL1 # 34.0 % tma_backend_bound
122+
# 6.4 % tma_bad_speculation
123+
# 29.4 % tma_frontend_bound
124+
# 30.2 % tma_retiring ( +- 0.57% )
93125
94-
0,00190782 +- 0,00000647 seconds time elapsed ( +- 0,34% )
126+
0.0021429 +- 0.0000126 seconds time elapsed ( +- 0.59% )
95127
```
96128

97129
### Build Scala Native image, print its size, and measure its start up time
@@ -107,20 +139,20 @@ Expected output:
107139
```text
108140
Performance counter stats for './example01_native.bin' (100 runs):
109141
110-
0,74 msec task-clock # 0,834 CPUs utilized ( +- 0,39% )
111-
0 context-switches # 0,000 /sec
112-
0 cpu-migrations # 0,000 /sec
113-
245 page-faults # 330,182 K/sec ( +- 0,04% )
114-
3 232 185 cycles # 4,356 GHz ( +- 0,41% )
115-
5 088 414 instructions # 1,57 insn per cycle ( +- 0,05% )
116-
927 130 branches # 1,249 G/sec ( +- 0,06% )
117-
16 482 branch-misses # 1,78% of all branches ( +- 0,44% )
118-
TopdownL1 # 23,2 % tma_backend_bound
119-
# 12,1 % tma_bad_speculation
120-
# 31,5 % tma_frontend_bound
121-
# 33,2 % tma_retiring ( +- 0,41% )
122-
123-
0,00089004 +- 0,00000503 seconds time elapsed ( +- 0,57% )
142+
0.80 msec task-clock # 0.823 CPUs utilized ( +- 0.41% )
143+
0 context-switches # 0.000 /sec
144+
0 cpu-migrations # 0.000 /sec
145+
246 page-faults # 306.115 K/sec ( +- 0.04% )
146+
3,345,318 cycles # 4.163 GHz ( +- 0.49% )
147+
5,077,992 instructions # 1.52 insn per cycle ( +- 0.05% )
148+
924,515 branches # 1.150 G/sec ( +- 0.05% )
149+
16,240 branch-misses # 1.76% of all branches ( +- 0.44% )
150+
TopdownL1 # 26.8 % tma_backend_bound
151+
# 11.7 % tma_bad_speculation
152+
# 29.4 % tma_frontend_bound
153+
# 32.1 % tma_retiring ( +- 0.48% )
154+
155+
0.00097599 +- 0.00000574 seconds time elapsed ( +- 0.59% )
124156
```
125157

126158
## RFC-8259 validation (example02)

0 commit comments

Comments
 (0)