5
5
Here you will learn how to build and run the simplest example and measure the startup time on Linux using
6
6
Debian packages
7
7
8
- ### Build uber jar, print its size, and measure its start up time
8
+ ### Build uber jar, print its size, and measure its start up time (tested with Oracle GraalVM 24-dev)
9
9
10
10
``` sh
11
11
sudo apt install linux-tools-common linux-tools-generic
@@ -18,20 +18,20 @@ Expected output:
18
18
``` text
19
19
Performance counter stats for './example01.jar' (100 runs):
20
20
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 % )
21
+ 275.05 msec task-clock # 2.067 CPUs utilized ( +- 0.19 % )
22
+ 1,970 context-switches # 7.162 K/sec ( +- 0.48 % )
23
+ 15 cpu-migrations # 54.536 /sec ( +- 2.23 % )
24
+ 22,159 page-faults # 80.565 K/sec ( +- 0.20 % )
25
+ 1,101,372,203 cycles # 4.004 GHz ( +- 0.20 % )
26
+ 1,504,873,660 instructions # 1.37 insn per cycle ( +- 0.10 % )
27
+ 297,952,673 branches # 1.083 G/sec ( +- 0.10 % )
28
+ 9,110,277 branch-misses # 3.06 % of all branches ( +- 0.11 % )
29
+ TopdownL1 # 14.1 % tma_backend_bound
30
+ # 35.6 % tma_bad_speculation
31
+ # 30.0 % tma_frontend_bound
32
+ # 20.3 % tma_retiring ( +- 0.13 % )
33
33
34
- 0.110362 +- 0.000163 seconds time elapsed ( +- 0.15 % )
34
+ 0.133067 +- 0.000190 seconds time elapsed ( +- 0.14 % )
35
35
```
36
36
37
37
### Build Scala JS output, print its size, and measure its start up time with ` node `
@@ -102,28 +102,28 @@ Expected output:
102
102
``` sh
103
103
sudo apt install linux-tools-common linux-tools-generic gcc zlib1g-dev
104
104
sudo sysctl kernel.perf_event_paranoid=1
105
- scala-cli --power package --graalvm-jvm-id graalvm-java23 :23.0.0 --native-image example01.sc --force -o example01_graalvm.bin -- --no-fallback -Os
105
+ scala-cli --power package --graalvm-jvm-id graalvm-oracle :23 --native-image example01.sc --force -o example01_graalvm.bin -- --no-fallback -O3
106
106
ls -l ./example01_graalvm.bin
107
107
perf stat -r 100 ./example01_graalvm.bin > /dev/null
108
108
```
109
109
Expected output:
110
110
``` text
111
111
Performance counter stats for './example01_graalvm.bin' (100 runs):
112
112
113
- 2.02 msec task-clock # 0.945 CPUs utilized ( +- 0.49 % )
114
- 1 context-switches # 493.912 /sec ( +- 8.42 % )
113
+ 1.84 msec task-clock # 0.939 CPUs utilized ( +- 0.40 % )
114
+ 1 context-switches # 542.721 /sec ( +- 3.21 % )
115
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 % )
116
+ 633 page-faults # 343.543 K/sec ( +- 0.01% )
117
+ 7,594,064 cycles # 4.121 GHz ( +- 0.49 % )
118
+ 11,150,492 instructions # 1.47 insn per cycle ( +- 0.04% )
119
+ 2,133,178 branches # 1.158 G/sec ( +- 0.03% )
120
+ 21,759 branch-misses # 1.02 % of all branches ( +- 0.84 % )
121
+ TopdownL1 # 32 .0 % tma_backend_bound
122
+ # 6.5 % tma_bad_speculation
123
+ # 30.0 % tma_frontend_bound
124
+ # 31.5 % tma_retiring ( +- 0.49 % )
125
125
126
- 0.0021429 +- 0.0000126 seconds time elapsed ( +- 0.59 % )
126
+ 0.00196304 +- 0.00000988 seconds time elapsed ( +- 0.50 % )
127
127
```
128
128
129
129
### Build Scala Native image, print its size, and measure its start up time
@@ -184,7 +184,7 @@ Here is an example of expected output:
184
184
Timing buffered disk reads: 2180 MB in 3.04 seconds = 716.07 MB/sec
185
185
```
186
186
187
- ### Build uber jar, print its size, and measure its running time (tested with Oracle Graal VM 24-dev)
187
+ ### Build uber jar, print its size, and measure its running time (tested with Oracle GraalVM 24-dev)
188
188
189
189
``` sh
190
190
scala-cli --power package --assembly example02.sc --force -o example02.jar
@@ -193,23 +193,23 @@ time ./example02.jar -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseEpsilonGC -J-X
193
193
```
194
194
Expected output:
195
195
``` text
196
- real 1m2,667s
197
- user 0m59,750s
198
- sys 0m3,171s
196
+ real 1m8.991s
197
+ user 1m5.239s
198
+ sys 0m4.102s
199
199
```
200
200
201
201
### Build GraalVM native image, print its size, and measure its running time
202
202
203
203
``` sh
204
- scala-cli --power package --graalvm-jvm-id graalvm-java23 :23.0.0 --native-image example02.sc --force -o example02_graalvm.bin -- --no-fallback --gc=epsilon -Os
204
+ scala-cli --power package --graalvm-jvm-id graalvm-oracle :23 --native-image example02.sc --force -o example02_graalvm.bin -- --no-fallback --gc=epsilon -O3
205
205
ls -l ./example02_graalvm.bin
206
206
time ./example02_graalvm.bin < 2023_06_430_65B0_in_network_rates.json 2> /dev/null
207
207
```
208
208
Expected output:
209
209
``` text
210
- real 1m45,502s
211
- user 1m42,411s
212
- sys 0m3,088s
210
+ real 1m34.353s
211
+ user 1m29.199s
212
+ sys 0m5.151s
213
213
```
214
214
215
215
### Build Scala Native image, print its size, and measure its running time
@@ -221,7 +221,7 @@ time ./example02_native.bin < 2023_06_430_65B0_in_network_rates.json 2> /dev/nul
221
221
```
222
222
Expected output:
223
223
``` text
224
- real 1m25,617s
225
- user 1m22,498s
226
- sys 0m3,116s
224
+ real 1m27.275s
225
+ user 1m23.233s
226
+ sys 0m4.038s
227
227
```
0 commit comments