Skip to content

Commit 9d7c554

Browse files
authored
Update README.md
1 parent c4ed7fb commit 9d7c554

File tree

1 file changed

+14
-40
lines changed

1 file changed

+14
-40
lines changed

jsoniter-scala-examples/README.md

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ sudo hdparm -Tt /dev/nvme0n1p4
180180
Here is an example of expected output:
181181
```text
182182
/dev/nvme0n1p4:
183-
Timing cached reads: 48588 MB in 2.00 seconds = 24334.91 MB/sec
184-
Timing buffered disk reads: 4456 MB in 3.00 seconds = 1485.08 MB/sec
183+
Timing cached reads: 50804 MB in 2.00 seconds = 25445.50 MB/sec
184+
Timing buffered disk reads: 8678 MB in 3.00 seconds = 2892.53 MB/sec
185185
```
186186

187187
### Build uber jar, print its size, and measure its running time (tested with Oracle GraalVM 25-dev)
@@ -193,61 +193,35 @@ time ./example02.jar -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseEpsilonGC -J-X
193193
```
194194
Expected output:
195195
```text
196-
real 0m37.615s
197-
user 0m35.187s
198-
sys 0m2.662s
196+
real 0m36.840s
197+
user 0m34.748s
198+
sys 0m2.362s
199199
```
200200

201-
### Build GraalVM native image, print its size, and measure its running time (tested with Oracle GraalVM 23)
201+
### Build GraalVM native image, print its size, and measure its running time (tested with Oracle GraalVM 24/23)
202202

203203
```sh
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 -H:+UnlockExperimentalVMOptions -R:MaxHeapSize=16m -H:-GenLoopSafepoints -H:-ParseRuntimeOptions -H:-IncludeMethodData --initialize-at-build-time
204+
scala-cli --power package --graalvm-jvm-id graalvm-oracle:24 --native-image example02.sc --force -o example02_graalvm.bin -- --no-fallback --gc=epsilon -O3 -H:+UnlockExperimentalVMOptions -R:MaxHeapSize=16m -H:-GenLoopSafepoints -H:-ParseRuntimeOptions -H:-IncludeMethodData --initialize-at-build-time
205205
ls -l ./example02_graalvm.bin
206206
time ./example02_graalvm.bin < 2023_06_430_65B0_in_network_rates.json 2> /dev/null
207207
```
208208
Expected output:
209209
```text
210-
real 0m44.963s
211-
user 0m42.471s
212-
sys 0m2.486s
213-
```
214-
215-
You can use profile guided optimization (PGO) to improve performance of Oracle GraalVM native image, for that you need:
216-
- build an instrumented GraalVM native image with `--pgo-instrument` option added:
217-
```sh
218-
scala-cli --power package --graalvm-jvm-id graalvm-oracle:23 --native-image example02.sc --force -o example02_graalvm_instrumented.bin -- --no-fallback --gc=epsilon -O3 --pgo-instrument -H:+UnlockExperimentalVMOptions -R:MaxHeapSize=16m -H:-GenLoopSafepoints -H:-ParseRuntimeOptions -H:-IncludeMethodData --initialize-at-build-time
219-
ls -l ./example02_graalvm_instrumented.bin
220-
```
221-
- run the instrumented image and collect the profile data:
222-
```sh
223-
time ./example02_graalvm_instrumented.bin < 2023_06_430_65B0_in_network_rates.json 2> /dev/null
224-
```
225-
- build a PGO-optimized GraalVM native image with `--pgo=default.iprof` option added:
226-
```sh
227-
scala-cli --power package --graalvm-jvm-id graalvm-oracle:23 --native-image example02.sc --force -o example02_graalvm_optimized.bin -- --no-fallback --gc=epsilon -O3 --pgo=default.iprof -H:+UnlockExperimentalVMOptions -R:MaxHeapSize=16m -H:-GenLoopSafepoints -H:-ParseRuntimeOptions -H:-IncludeMethodData --initialize-at-build-time
228-
ls -l ./example02_graalvm_optimized.bin
229-
```
230-
- run the PGO-optimized image:
231-
```sh
232-
time ./example02_graalvm_optimized.bin < 2023_06_430_65B0_in_network_rates.json 2> /dev/null
233-
```
234-
Expected output:
235-
```text
236-
real 0m43.674s
237-
user 0m41.213s
238-
sys 0m2.461s
210+
real 0m45.922s
211+
user 0m43.495s
212+
sys 0m2.424s
239213
```
240214

241215
### Build Scala Native image, print its size, and measure its running time
242216

243217
```sh
244-
scala-cli --power package --native-version 0.5.7 --native example02.sc --native-mode release-full --native-gc none --native-lto thin --native-multithreading=false --force -o example02_native.bin
218+
scala-cli --power package --native-version 0.5.8 --native example02.sc --native-mode release-full --native-gc none --native-lto thin --native-multithreading=false --force -o example02_native.bin
245219
ls -l ./example02_native.bin
246220
time ./example02_native.bin < 2023_06_430_65B0_in_network_rates.json 2> /dev/null
247221
```
248222
Expected output:
249223
```text
250-
real 0m49.232s
251-
user 0m46.838s
252-
sys 0m2.389s
224+
real 0m49.766s
225+
user 0m47.408s
226+
sys 0m2.355s
253227
```

0 commit comments

Comments
 (0)