Skip to content

Commit 773dab2

Browse files
authored
Merge pull request #322 from graalvm/archive-demos-3
[GR-60094] Review and move multithreading-demo demo to archive.
2 parents 60905ec + 7c125d3 commit 773dab2

File tree

12 files changed

+24
-37
lines changed

12 files changed

+24
-37
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,38 @@
1-
name: multithreading-demo
1+
name: archive/multithreading-demo
22
on:
33
push:
44
paths:
5-
- 'multithreading-demo/**'
6-
- '.github/workflows/multithreading-demo.yml'
5+
- 'archive/multithreading-demo/**'
6+
- '.github/workflows/archive-multithreading-demo.yml'
77
pull_request:
88
paths:
9-
- 'multithreading-demo/**'
10-
- '.github/workflows/multithreading-demo.yml'
11-
schedule:
12-
- cron: "0 0 1 * *" # run every month
9+
- 'archive/multithreading-demo/**'
10+
- '.github/workflows/archive-multithreading-demo.yml'
1311
workflow_dispatch:
1412
permissions:
1513
contents: read
1614
jobs:
1715
run:
18-
name: Run 'multithreading-demo'
16+
name: Run 'archive/multithreading-demo'
1917
runs-on: ubuntu-latest
2018
timeout-minutes: 15
21-
strategy:
22-
matrix:
23-
java-version: ['22', 'latest-ea']
2419
steps:
2520
- uses: actions/checkout@v4
2621
- uses: graalvm/setup-graalvm@v1
2722
with:
28-
java-version: ${{ matrix.java-version }}
23+
java-version: '21'
2924
distribution: 'graalvm'
3025
github-token: ${{ secrets.GITHUB_TOKEN }}
3126
cache: 'maven'
3227
- name: Run 'multithreading-demo-oversized'
3328
run: |
34-
cd multithreading-demo/multithreading-demo-oversized
29+
cd archive/multithreading-demo/multithreading-demo-oversized
3530
mvn --no-transfer-progress package
3631
java -jar target/multithreading-1.0-jar-with-dependencies.jar
3732
./target/multithreading-image-oversized
3833
- name: Run 'multithreading-demo-improved'
3934
run: |
40-
cd multithreading-demo/multithreading-demo-improved
35+
cd archive/multithreading-demo/multithreading-demo-improved
4136
mvn --no-transfer-progress package
4237
java -jar target/multithreading-1.0-jar-with-dependencies.jar
4338
./target/multithreading-image-improved

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ cd graalvm-demos
4747
<td align="left" width="30%"><a href="/java-simple-stream-benchmark/">java-simple-stream-benchmark</a><br><a href="https://github.com/graalvm/graalvm-demos/actions/workflows/java-simple-stream-benchmark.yml"><img alt="java-simple-stream-benchmark" src="https://github.com/graalvm/graalvm-demos/actions/workflows/java-simple-stream-benchmark.yml/badge.svg" /></a></td>
4848
<td align="left" width="70%">Demonstrates how the Graal compiler can achieve better performance for highly abstracted programs like those using Streams, Lambdas<br><strong>Technologies: </strong>Graal compiler, C2<br><strong>Reference: </strong><a href="https://luna.oracle.com/lab/d502417b-df66-45be-9fed-a3ac8e3f09b1/steps#task-2-run-demos-java-microbenchmark-harness-jmh">Simple Java Stream Benchmark</a></td>
4949
</tr>
50-
<tr>
51-
<td align="left" width="30%"><a href="/multithreading-demo/">multithreading-demo</a><br><a href="https://github.com/graalvm/graalvm-demos/actions/workflows/streams.yml"><img alt="streams" src="https://github.com/graalvm/graalvm-demos/actions/workflows/streams.yml/badge.svg" /></a></td>
52-
<td align="left" width="70%">Demonstrates how to optimize a Java application that does synchronous and asynchronous threads execution<br><strong>Technologies: </strong>Native Image Build Reports, Native Build Tools Maven plugin <br><strong>Reference: </strong><a href="https://medium.com/graalvm/making-sense-of-native-image-contents-741a688dab4d">Making sense of Native Image contents</a></td>
53-
</tr>
5450
<tr>
5551
<td align="left" width="30%"><a href="/native-image-configure-examples/">native-image-configure-examples</a><br><a href="https://github.com/graalvm/graalvm-demos/actions/workflows/streams.yml"><img alt="streams" src="https://github.com/graalvm/graalvm-demos/actions/workflows/streams.yml/badge.svg" /></a></td>
5652
<td align="left" width="70%">Demonstrates how you can influence the classes initialization at the image build time<br><strong>Technologies: </strong>Native Image, Maven<br><strong>Reference: </strong><a href="https://medium.com/graalvm/understanding-class-initialization-in-graalvm-native-image-generation-d765b7e4d6ed">Understanding Class Initialization in GraalVM Native Image Generation</a></td>

multithreading-demo/README.md renamed to archive/multithreading-demo/README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ Each thread loops through exactly the same array of integers and generates a str
55
The program calculates the time taken to perform the task synchronously and asynchronously.
66

77
Multithreading demo is comprised of two sub-projects, each built with Maven: **Multithreading Demo Oversized** and **Multithreading Demo Improved**.
8-
The _pom.xml_ file of each sub-project includes the [Native Image Maven plugin](https://graalvm.github.io/native-build-tools/latest/maven-plugin.html), which instructs Maven to generate a native executable of a JAR file with all dependencies at the `mvn package` step.
8+
The _pom.xml_ file of each sub-project includes the [Maven plugin for Native Image building](https://graalvm.github.io/native-build-tools/latest/maven-plugin.html), which instructs Maven to generate a native executable of a JAR file with all dependencies at the `mvn package` step.
99

1010
The plugin also generates a report using the [Native Image Build Reports](https://www.graalvm.org/latest/reference-manual/native-image/overview/Options/#build-output-and-build-report) feature in the _target_ directory with useful visualizations and comprehensive insights into different metrics of the native executable and the build process itself.
1111

1212
```xml
1313
<plugin>
1414
<groupId>org.graalvm.buildtools</groupId>
1515
<artifactId>native-maven-plugin</artifactId>
16-
<version>0.10.1</version>
16+
<version>${org.graalvm.buildtools.version}</version>
1717
<extensions>true</extensions>
1818
<executions>
1919
<execution>
@@ -44,15 +44,15 @@ The plugin also generates a report using the [Native Image Build Reports](https:
4444

4545
1. Download and install the latest GraalVM JDK using [SDKMAN!](https://sdkman.io/).
4646
```bash
47-
sdk install java 22.0.1-graal
47+
sdk install java 21.0.1-graal
4848
```
4949

5050
2. Download or clone the repository and navigate into the `multithreading-demo/multithreading-demo-oversized_` directory:
5151
```bash
5252
git clone https://github.com/graalvm/graalvm-demos
5353
```
5454
```bash
55-
cd multithreading-demo/multithreading-demo-oversized
55+
cd graalvm-demos/archive/multithreading-demo/multithreading-demo-oversized
5656
```
5757

5858
## Multithreading Demo Oversized
@@ -89,6 +89,4 @@ Multithreading Demo Improved contains an enhanced version of the same program.
8989
./target/multithreading-image-improved
9090
```
9191

92-
### Learn More
93-
94-
Learn how you can optimize a Java application by applying Profile-guided optimization (PGO) and inspect a profile using [Native Image Build Reports](https://www.graalvm.org/jdk22/reference-manual/native-image/optimizations-and-performance/PGO/build-reports/).
92+
Continue reading about how you can inspect a profile and potentially optimize size of your native application using [Build Reports](https://www.graalvm.org/latest/reference-manual/native-image/guides/optimize-native-executable-size-using-build-report/).

multithreading-demo/multithreading-demo-improved/pom.xml renamed to archive/multithreading-demo/multithreading-demo-improved/pom.xml

+5-6
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<version>1.0</version>
1010

1111
<properties>
12-
<native.maven.plugin.version>0.10.1</native.maven.plugin.version>
13-
<maven.compiler.source>22</maven.compiler.source>
14-
<maven.compiler.target>22</maven.compiler.target>
12+
<native.maven.plugin.version>0.10.4</native.maven.plugin.version>
13+
<maven.compiler.source>21</maven.compiler.source>
14+
<maven.compiler.target>21</maven.compiler.target>
1515
</properties>
1616

1717
<dependencies>
@@ -87,9 +87,8 @@
8787
<imageName>multithreading-image-improved</imageName>
8888
<fallback>false</fallback>
8989
<buildArgs>
90-
<buildArg>
91-
-H:+UnlockExperimentalVMOptions -H:+BuildReport --initialize-at-build-time
92-
</buildArg>
90+
<buildArg>-H:+UnlockExperimentalVMOptions -H:+BuildReport</buildArg>
91+
<buildArg>--initialize-at-build-time</buildArg>
9392
</buildArgs>
9493
<agent>
9594
<enabled>true</enabled>

multithreading-demo/multithreading-demo-oversized/pom.xml renamed to archive/multithreading-demo/multithreading-demo-oversized/pom.xml

+5-6
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<version>1.0</version>
1010

1111
<properties>
12-
<native.maven.plugin.version>0.10.1</native.maven.plugin.version>
13-
<maven.compiler.source>22</maven.compiler.source>
14-
<maven.compiler.target>22</maven.compiler.target>
12+
<native.maven.plugin.version>0.10.4</native.maven.plugin.version>
13+
<maven.compiler.source>21</maven.compiler.source>
14+
<maven.compiler.target>21</maven.compiler.target>
1515
</properties>
1616

1717
<dependencies>
@@ -87,9 +87,8 @@
8787
<imageName>multithreading-image-oversized</imageName>
8888
<fallback>false</fallback>
8989
<buildArgs>
90-
<buildArg>
91-
--no-fallback -H:+UnlockExperimentalVMOptions -H:+BuildReport --initialize-at-build-time
92-
</buildArg>
90+
<buildArg>-H:+UnlockExperimentalVMOptions -H:+BuildReport</buildArg>
91+
<buildArg>--initialize-at-build-time</buildArg>
9392
</buildArgs>
9493
<agent>
9594
<enabled>true</enabled>

0 commit comments

Comments
 (0)