Skip to content

fbcouto/java-multimerge-dll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Adaptive Parallel Multimerge Sort (Java Native Extension via JNI)

This repository contains the high-performance native extension for the Java Virtual Machine (JVM) using the Multimerge parallel sorting algorithm.

By leveraging JNI (Java Native Interface) and the Rust toolchain, the core engine is compiled into a high-performance Dynamic Link Library (.dll on Windows / .so on Linux). This allows Java applications to offload intensive sorting workloads to multi-threaded hardware with absolute zero-copy memory overhead.


🔗 Core Algorithm & Academic Background

📌 Note: The mathematical foundations, dynamic heuristics, and exhaustive standalone benchmarks of the Multimerge engine are fully detailed and tested in the primary repository:

👉 Core Multimerge Sorting Repository

The core theoretical foundation of this parallel architecture is based on the original research and paper:

  • Title: Multimerge
  • Authors: Fernando B. Couto & Fábio S. Couto
  • Conference: PDPTA'11 — The 2011 International Conference on Parallel and Distributed Processing Techniques and Applications
  • Lecture Series: WorldComp'11 (The 2011 World Congress in Computer Science, Computer Engineering, and Applied Computing)
  • The architecture implements a hybrid processing model based on the original Multimerge paper published in PDPTA'11 (The 2011 International Conference on Parallel and Distributed Processing Techniques and Applications).

It modernizes those multi-merge paradigms by utilizing runtime entropy sampling (an Adaptive Oscillation Heuristic) and Rayon's work-stealing parallel scheduler.


📊 Performance Demonstration

This engine serves as a candidate to augment or replace Java's standard Arrays.sort() in high-throughput data pipelines.

The following charts compare the performance of the Multimerge Rust engine versus native Java across four data scales:

🔢 Numeric Dataset Benchmark

!images/javanumaleat.png

📝 Text Dataset Benchmark

!images/javatextoaleat.png


🛠️ Engineering Implementation

The integration utilizes critical JNI memory pinning to eliminate Garbage Collector interference:

  • Zero-Copy Architecture: By using get_array_elements_critical, the engine accesses the JVM heap memory directly, preventing redundant data serialization.
  • Rust Core: The sorting logic is written in Rust, ensuring memory safety and massive parallelism via Rayon.

🛠️ Compilation & DLL Generation Guide

To bridge the gap between the Java Virtual Machine and Rust, the project compiles the core logic into a high-performance native library (.dll on Windows / .so on Linux). Java interfaces with this library using the Java Native Interface (JNI).


1. Prerequisites

Ensure your local environment has the following toolchains installed:

  • Rust Toolchain: Stable channel (cargo, rustc >= 1.70)
  • JDK: Version 8 or higher (javac, java)

2. Layout Structure

multimerge-Java-dll/
├── Cargo.toml            # Rust compilation manifest
├── BenchmarkSort.java    # Automated Java benchmark suite
└── src/
    └── lib.rs            # JNI Bindings + Core Algorithm

📜 License

This project is licensed under the Apache License, Version 2.0.

About

This repository contains the high-performance native extension for the Java Virtual Machine (JVM) using the Multimerge parallel sorting algorithm.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors