File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ import java .util .*;
2+ import java .util .stream .*;
3+
4+ /**
5+ * Compile: `javac ProfilingTest.java`
6+ * Test AOT cache with two-step:
7+ * * Record mode: `java -XX:AOTMode=record -XX:AOTConfiguration=app.aotconf ProfilingTest`
8+ * * Create mode: `java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconf -XX:AOTCache=app.aot`
9+ * * Run with AOT cache: `java -XX:AOTCache=app.aot ProfilingTest`
10+ */
11+ public class ProfilingTest {
12+ static String greeting (int n ) {
13+ var words = List .of ("Hello" , "" + n , "world!" );
14+ return words .stream ()
15+ .filter (w -> !w .contains ("0" ))
16+ .collect (Collectors .joining (", " ));
17+ }
18+
19+ public static void main (String ... args ) {
20+ for (int i = 0 ; i < 100_000 ; i ++)
21+ greeting (i );
22+ System .out .println (greeting (0 ));
23+ }
24+ }
You can’t perform that action at this time.
0 commit comments