Skip to content

Commit 0ffb1f0

Browse files
committed
Add no GC options in supported builds for example02.sc
1 parent f323f29 commit 0ffb1f0

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

jsoniter-scala-examples/README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,26 +128,30 @@ Expected output:
128128
An example of a command line application that reads the system input, parses and validates JSON according to the latest
129129
specification and in case of any error prints it to the system error output.
130130

131+
Scala.js build is missing because it doesn't support reading from the system input.
132+
133+
No GC options are used to speed up JSON validation for all supported builds.
134+
131135
### Build uber jar, print its size, and measure its start up time
132136

133137
```sh
134138
scala-cli --power package --assembly example02.sc --force -o example02.jar
135139
ls -l ./example02.jar
136-
time ./example02.jar <test.json 2> /dev/null
140+
time ./example02.jar -J-XX:+UnlockExperimentalVMOptions -J-XX:+UseEpsilonGC -J-Xms16m -J-Xmx16m -J-XX:+AlwaysPreTouch < test.json 2> /dev/null
137141
```
138142
Expected output:
139143
```text
140-
real 0m0.087s
141-
user 0m0.112s
142-
sys 0m0.022s
144+
real 0m0.085s
145+
user 0m0.110s
146+
sys 0m0.017s
143147
```
144148

145149
### Build GraalVM native image, print its size, and measure its start up time
146150

147151
```sh
148-
scala-cli --power package --jvm graalvm --native-image example02.sc --force -o example02_graalvm.bin -- --no-fallback
152+
scala-cli --power package --jvm graalvm --native-image example02.sc --force -o example02_graalvm.bin -- --no-fallback --gc=epsilon
149153
ls -l ./example02_graalvm.bin
150-
time ./example02_graalvm.bin <test.json 2> /dev/null
154+
time ./example02_graalvm.bin < test.json 2> /dev/null
151155
```
152156
Expected output:
153157
```text
@@ -159,13 +163,13 @@ sys 0m0.003s
159163
### Build Scala Native image, print its size, and measure its start up time
160164

161165
```sh
162-
scala-cli --power package --native-version 0.4.16 --native example02.sc --force -o example02_native.bin
166+
scala-cli --power package --native-version 0.4.16 --native example02.sc --native-gc none --force -o example02_native.bin
163167
ls -l ./example02_native.bin
164-
time ./example02_native.bin <test.json 2> /dev/null
168+
time ./example02_native.bin < test.json 2> /dev/null
165169
```
166170
Expected output:
167171
```text
168-
real 0m0.004s
169-
user 0m0.004s
172+
real 0m0.003s
173+
user 0m0.003s
170174
sys 0m0.000s
171175
```

0 commit comments

Comments
 (0)