{"id":16105814,"url":"https://github.com/devlights/java-graalvm-native-image-example","last_synced_at":"2025-04-06T03:13:22.949Z","repository":{"id":179899422,"uuid":"662896034","full_name":"devlights/java-graalvm-native-image-example","owner":"devlights","description":"Oracle GraalVM example by java. (using native-image)","archived":false,"fork":false,"pushed_at":"2023-07-09T14:42:35.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-12T08:58:27.955Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devlights.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-06T05:57:51.000Z","updated_at":"2023-07-06T06:37:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"06038d55-7129-4240-b15e-07022789f0da","html_url":"https://github.com/devlights/java-graalvm-native-image-example","commit_stats":null,"previous_names":["devlights/java-graalvm-native-image-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fjava-graalvm-native-image-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fjava-graalvm-native-image-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fjava-graalvm-native-image-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fjava-graalvm-native-image-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devlights","download_url":"https://codeload.github.com/devlights/java-graalvm-native-image-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427012,"owners_count":20937214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T19:10:42.184Z","updated_at":"2025-04-06T03:13:22.933Z","avatar_url":"https://github.com/devlights.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# java-graalvm-native-image-example\n\nOracle GraalVM example by java. (using native-image)\n\n## Requirements\n\n### [GraalVM](https://www.graalvm.org/)\n\n```sh\n$ wget https://download.oracle.com/graalvm/20/latest/graalvm-jdk-20_linux-x64_bin.tar.gz\n$ tar zxf graalvm-jdk-*.tar.gz\n$ mv graalvm-jdk-*/ graalvm\n$ graalvm/bin/gu install native-image\n```\n\n### [Task](https://taskfile.dev/)\n\n```sh\n$ go install github.com/go-task/task/v3/cmd/task@latest\n```\n\n## How to\n\n### Run\n\n```sh\n$ task helloworld\ntask: [install-nativeimage] /workspace/java-graalvm-native-image-example/graalvm/bin/gu install native-image\nPicked up JAVA_TOOL_OPTIONS:  -Xmx3489m\nDownloading: Artifacts catalog from gds.oracle.com\nSkipping ULN EE channels, no username provided.\nDownloading: Component catalog from www.graalvm.org\nProcessing Component: Native Image\nComponent Native Image (org.graalvm.native-image) is already installed.\ntask: [helloworld] rm -f ./app ./App.class\ntask: [helloworld] /workspace/java-graalvm-native-image-example/graalvm/bin/javac App.java\nPicked up JAVA_TOOL_OPTIONS:  -Xmx3489m\ntask: [helloworld] /workspace/java-graalvm-native-image-example/graalvm/bin/native-image App\n========================================================================================================================\nGraalVM Native Image: Generating 'app' (executable)...\n========================================================================================================================\n[1/8] Initializing...                                                                                    (7.8s @ 0.18GB)\n Java version: 20.0.1+9, vendor version: Oracle GraalVM 20.0.1+9.1\n Graal compiler: optimization level: 2, target machine: x86-64-v3, PGO: ML-inferred\n C compiler: gcc (linux, x86_64, 11.3.0)\n Garbage collector: Serial GC (max heap size: 80% of RAM)\n[2/8] Performing analysis...  [*****]                                                                   (12.9s @ 0.27GB)\n   2,067 (61.54%) of  3,359 types reachable\n   2,054 (47.01%) of  4,369 fields reachable\n   9,606 (38.98%) of 24,641 methods reachable\n     670 types,   106 fields, and   419 methods registered for reflection\n      49 types,    32 fields, and    48 methods registered for JNI access\n       4 native libraries: dl, pthread, rt, z\n[3/8] Building universe...                                                                               (1.6s @ 0.42GB)\n[4/8] Parsing methods...      [**]                                                                       (4.8s @ 0.40GB)\n[5/8] Inlining methods...     [***]                                                                      (1.1s @ 0.34GB)\n[6/8] Compiling methods...    [******]                                                                  (34.0s @ 0.35GB)\n[7/8] Layouting methods...    [*]                                                                        (0.8s @ 0.38GB)\n[8/8] Creating image...       [*]                                                                        (1.0s @ 0.42GB)\n   3.70MB (48.26%) for code area:     4,490 compilation units\n   3.61MB (47.09%) for image heap:   56,776 objects and 1 resources\n 364.72kB ( 4.65%) for other data\n   7.66MB in total\n------------------------------------------------------------------------------------------------------------------------\nTop 10 origins of code area:                                Top 10 object types in image heap:\n   2.04MB java.base                                          721.46kB byte[] for code metadata\n   1.32MB svm.jar (Native Image)                             473.01kB byte[] for java.lang.String\n 100.54kB com.oracle.svm.svm_enterprise                      378.19kB java.lang.String\n  51.70kB jdk.proxy1                                         344.98kB java.lang.Class\n  44.55kB jdk.proxy3                                         264.89kB byte[] for general heap data\n  34.19kB org.graalvm.nativeimage.base                       164.19kB java.util.HashMap$Node\n  30.61kB org.graalvm.sdk                                    112.63kB char[]\n  19.63kB jdk.internal.vm.compiler                            96.91kB byte[] for reflection metadata\n  18.07kB jdk.internal.vm.ci                                  87.88kB java.lang.Object[]\n  15.65kB jdk.proxy2                                          80.74kB com.oracle.svm.core.hub.DynamicHubCompanion\n  816.00B for 1 more packages                                527.61kB for 553 more object types\n------------------------------------------------------------------------------------------------------------------------\nRecommendations:\n G1GC: Use the G1 GC ('--gc=G1') for improved latency and throughput.\n PGO:  Use Profile-Guided Optimizations ('--pgo') for improved throughput.\n HEAP: Set max heap for improved and more predictable memory usage.\n CPU:  Enable more CPU features with '-march=native' for improved performance.\n QBM:  Use the quick build mode ('-Ob') to speed up builds during development.\n------------------------------------------------------------------------------------------------------------------------\n                        2.3s (3.5% of total time) in 175 GCs | Peak RSS: 1.09GB | CPU load: 3.75\n------------------------------------------------------------------------------------------------------------------------\nProduced artifacts:\n /workspace/java-graalvm-native-image-example/helloworld/app (executable)\n========================================================================================================================\nFinished generating 'app' in 1m 4s.\ntask: [helloworld] file ./app\n./app: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=acc49c38c534692b87b663e9b88fe8b2c4d0ed7e, for GNU/Linux 3.2.0, with debug_info, not stripped\ntask: [helloworld] ./app\nhello world\n```\n\n## REFERENCES\n\n- https://www.graalvm.org/\n- https://medium.com/graalvm/a-new-graalvm-release-and-new-free-license-4aab483692f5\n- https://www.graalvm.org/latest/reference-manual/native-image/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlights%2Fjava-graalvm-native-image-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevlights%2Fjava-graalvm-native-image-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlights%2Fjava-graalvm-native-image-example/lists"}