# Conflicts: # app/src/main/java/de/uni_marburg/powersort/benchmark/Main.java # app/src/main/java/de/uni_marburg/powersort/sort/SortEnum.java
Bring Powersort to Java
Implementation of Powersort with the aim of integrating it into OpenJDK. Benchmarks are used to ensure that the runtime of the new sorting algorithm is never slower than the current Timsort implementation.
Setup
We use Gradle for dependency and build management.
Commandline
Check which Java toolchains Gradle finds:
./gradlew javaToolchains
This should include version >= 23, e.g.:
+ N/A JDK 23-ga
| Location: /nix/store/48290hnlb13xmwjw9y16a1s785993bv7-openjdk-23-ga/lib/openjdk
| Language Version: 23
| Vendor: N/A
| Architecture: amd64
| Is JDK: true
| Detected by: Current JVM
Development Setup with nix
The provided shell.nix file can be used to set up a development environment with IntelliJ. The only prerequisite is to have a working nix
installation for which there are multiple possibilities, e.g:
# https://github.com/DeterminateSystems/nix-installer?tab=readme-ov-file#determinate-nix-installer
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \
sh -s -- install
Then the dependencies (JDK23, Gradle, IntelliJ) can be installed with:
nix-shell
IntelliJ
When using nix-shell
, some manual configuration is necessary:
STRG
ALT
SHIFT
s
-> SDK -> add JDK ->- home path:
/usr/lib/openjdk
- name:
usr-lib-jdk
- home path:
STRG
ALT
s
-> build tools -> gradle ->- local installation:
/usr/lib/gradle
- Gradle JVM:
usr-lib-jdk
- local installation:
Tasks
List all Gradle tasks which can be run:
./gradlew tasks
This can also be done graphically in IntelliJ:
Test Cases
Run the task "test":
./gradlew test
Benchmark
There are two different benchmarks. One is based on the JMH benchmark framework, the other one is a custom benchmark implementation.
./gradlew jmh
./gradlew runCustomBenchmark