https://github.com/pamaldi/isaura-jdk19-experiment
Some jdk 19 experiment
https://github.com/pamaldi/isaura-jdk19-experiment
Last synced: over 1 year ago
JSON representation
Some jdk 19 experiment
- Host: GitHub
- URL: https://github.com/pamaldi/isaura-jdk19-experiment
- Owner: pamaldi
- Created: 2022-11-23T14:34:15.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-18T09:10:43.000Z (about 3 years ago)
- Last Synced: 2025-01-24T22:41:47.588Z (over 1 year ago)
- Language: Java
- Size: 40 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Isaura experiment
Some experiment with jdk 19
# Build
An [OpenJDK 19](https://jdk.java.net/19/) or later build is required. At the time of this writing, virtual
threads are a preview feature. That is why `--enable-preview` is provided below.
---
Build with `mvn`:
```shell
mvn compile
```
## JMH
Some experiments in [jmh] (https://github.com/openjdk/jmh).
JMH is a library for benchmarks written in Java and other languages targeting the JVM.
The [BenchReadingTextFile.java](src/main/java/cloud/isaura/experimental/bench/BenchReadingTextFile.java) class
test the number of operations for a simple task: generate tokens for a large sting, using two different methods:
- The method split of the String class
- The StringTokenizer class
In a system with
Available processors (cores): 12
Free memory (bytes): 849800928
Maximum memory (bytes): 4208984064
Total memory available to JVM (bytes): 975175680
the benchmarks between split and tokenizer are the following:
| Benchmark | Mode | Cnt | Score | Units |
|----------------------------------|------|-------| ----- | ---- |
| BenchReadingTextFile.split | thrpt | 5 | ≈ 10⁻³ | ops/ns |
| BenchReadingTextFile.tokenizer | thrpt | 5 | 2,990 | ops/ns |
| BenchReadingTextFile.split | avgt | 5 | 2291,476 | ns/op |
| BenchReadingTextFile.tokenizer | avgt | 5 | 0,320 | ns/op |
## JOL
Some experiments in [jol] (https://github.com/openjdk/jol).
JOL is a library that that helps you measure size of objects in java.
The [TokenizerTest.java](src/main/java/cloud/isaura/experimental/text/TokenizerTest.java) class
tokenize and store in an HashMap a dataset of song lyrics.
The jol library output as follows:
| Count | Avg | sum | Description |
|--------------------------------|-----| ----- |-------------|
| 1 | 524304 | 524304 | [Ljava.util.HashMap$Node; |