β‘ High-performance hardware vector acceleration engine (AVX2, AVX-512, NEON) for the JVM.
FastSIMD provides a unified SIMD abstraction layer for Java. It encapsulates 32-byte parallel delimiter matching, bulk memory transfers, vector math, and pixel format conversions using hardware intrinsics.
Watch Demo (YouTube) | Watch JMH Benchmark (YouTube)
import fastsimd.*;
import fastmemory.Memory;
import fastpointer.Pointer;
public class Demo {
public static void main(String[] args) {
// 1. Allocate 32-byte aligned memory via FastMemory
try (Memory memory = Memory.allocateAligned(1024, 32)) {
Pointer ptr = memory.pointer();
// Write 32 bytes of test string
byte[] bytes = "Hello World! FastSIMD AVX2 Test".getBytes();
for (int i = 0; i < bytes.length; i++) {
ptr.setByte(i, bytes[i]);
}
// 2. Perform 32-byte SIMD parallel search for 'F'
int index = SIMD.findByte(ptr, bytes.length, (byte) 'F');
System.out.println("SIMD parallel found 'F' at index: " + index);
}
}
}- Why FastSIMD?
- Quick Start
- Key Features
- Real-World Use Cases
- Performance Benchmarks
- API Quick Reference
- Technical Demos & Benchmarks
- Installation
- Documentation
- Platform Support
- License
Standard Java loops process arrays sequentially byte-by-byte or rely on unpredictable JIT auto-vectorization that often fails on complex branching. FastSIMD provides:
- Explicit 256-Bit AVX2 Vector Acceleration β Process 32 bytes or 8 single-precision floats per CPU cycle using native SIMD intrinsics (
_mm256_cmpeq_epi8,_mm256_movemask_epi8). - 28+ GB/sec Scan Bandwidth β Execute ultra-fast log scanning, string searching, and delimiter matching at pure CPU memory bus speeds (15x faster than standard Java loops).
- Zero-Allocation Hardware Intrinsics β Perform bulk memory transfers, vector math, and byte sweeps directly on off-heap native memory pointers without triggering Garbage Collector pauses.
FastSIMD bypasses compiler guesswork by emitting deterministic hardware vector instructions directly via JNI:
| Feature | Standard Java Loop | JDK Vector API (Incubator) | FastSIMD |
|---|---|---|---|
| Instruction Execution | Scalar (1 byte / cycle) | JIT-compiled IR vectors | Explicit Hardware Intrinsics |
| Vector Width | None (1 byte) | 128 / 256 / 512 bit | 256-Bit AVX2 (32 Bytes / Cycle) |
| Scan Bandwidth | ~1.8 GB/sec | ~12β18 GB/sec | > 28 GB/sec (Bus Speed) |
| Branching Resilience | Scalar fallback | JIT bails on branch | Branchless Vector Masking |
| JVM Configuration | Default Java runtime | Requires --add-modules |
0 JVM Flags (Pure Native DLL) |
| Dependencies | JDK standard lib | JVM Incubator module | Pure Java 17+ backed by FastCore |
- π SIMD Scan: 32-byte parallel delimiter & byte searching (
_mm256_cmpeq_epi8,_mm256_movemask_epi8). - β‘ Bulk Memory & Prefetching: 256-bit unaligned/aligned loads/stores and cache prefetching.
- π’ Vector Math: 8-way Float32 and 4-way Float64 SIMD arithmetic for 3D and matrix operations.
- π¨ Pixel & Convert: Color space conversion (RGBA <-> BGRA) and FloatβInt transformations.
- β‘ High-Frequency Trading (HFT): Scan FIX protocol streams and order book market ticks at 28+ GB/sec without GC pauses.
- π SIEM & Security Log Mining: Search multi-gigabyte server logs for threat patterns (
CRITICAL_ALERT,JWT_EXPIRED) in milliseconds. - π€ AI Tensor Data Pipelines: Perform zero-copy vector normalization and memory alignment for local GGUF LLM models.
FastSIMD is engineered for ultra-high-throughput vector acceleration. In the official JMH Benchmark, the system measured native AVX2 256-bit vector search vs standard scalar loops over a 64 MB memory buffer:
Benchmark Mode Cnt Score Error Units
JMH_SIMD.benchmarkAVX2FindByte thrpt 2 19632.158 ops/s
| Method | Description | Docs |
|---|---|---|
SIMD.findByte(ptr, length, target) |
Scans memory 32 bytes per cycle for target byte (AVX2). | Reference |
SIMD.copy(src, dst, bytes) |
High-throughput 256-bit SIMD bulk memory copy. | Reference |
SIMD.isAVX2Supported() |
Returns true if CPU AVX2 vector extensions are supported. |
Reference |
| Case | Java Example | Launcher | Description |
|---|---|---|---|
| AVX2 SIMD Parallel Search | Demo.java | run-demo.bat |
End-to-end 100 MB streaming comparison matching delimiters via 256-bit AVX2 vector instructions vs scalar Java loops. |
| JMH Microbenchmark Suite | Benchmark.java | run-benchmark.bat |
OpenJDK JMH throughput & latency test suite for SIMD byte scanning and vectorized off-heap memory copies. |
Add the JitPack repository and the dependencies to your pom.xml:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!-- FastSIMD Hardware Vector Engine -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastSIMD</artifactId>
<version>0.1.3</version>
</dependency>
<!-- FastMemory Aligned Allocator -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastMemory</artifactId>
<version>0.1.1</version>
</dependency>
<!-- FastPointer Address Wrapper -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastPointer</artifactId>
<version>0.1.1</version>
</dependency>
<!-- FastCore Native Loader -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastCore</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.andrestubbe:FastSIMD:0.1.3'
implementation 'com.github.andrestubbe:FastMemory:0.1.1'
implementation 'com.github.andrestubbe:FastPointer:0.1.1'
implementation 'com.github.andrestubbe:FastCore:0.1.0'
}Download the latest JARs directly to add them to your classpath:
- β‘ FastSIMD-0.1.3.jar (Hardware Vector Engine)
- πΎ FastMemory-0.1.1.jar (32-Byte Aligned Allocator)
- π FastPointer-0.1.1.jar (Native Primitive Pointer)
- βοΈ fastcore-0.1.0.jar (Mandatory Native Loader)
Important
All JARs must be in your classpath for the JNI calls to function correctly.
- CHANGELOG.md: Release notes.
- COMPILE.md: Full compilation guide (MSVC C++17 build chain + JNI Setup).
- REFERENCE.md: Full API descriptions, border configurations, and codepoint index.
- PHILOSOPHY.md: The engineering rationale for zero-allocation performance.
- ROADMAP.md: Future milestones and planned features.
| Platform | Status |
|---|---|
| Windows 10/11 (AVX2 / x64) | β Fully Supported |
| Linux (AVX2 / x64) | π§ Planned |
| macOS (Apple Silicon NEON) | π§ Planned |
- FastBytes β High-performance SIMD-powered byte engine
- FastMemory β SIMD 32-byte aligned off-heap memory allocation and page locking
- FastPointer β Zero-overhead native address arithmetic
- FastCore β Native JNI loader for FastJava libraries
MIT License β See LICENSE for details.
Part of the FastJava Ecosystem β Making the JVM faster. Small package. Maximum speed. Zero bloat. ππ
