Skip to content
andrestubbePublic

About

🏎️ Unified hardware vector acceleration engine (AVX2, AVX-512, NEON) for Java.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

40 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FastSIMD 0.1.3 [ALPHA-2026-08] β€” Hardware Vectorization Framework (AVX2, AVX-512, NEON)

Status License: MIT Java Platform JitPack


⚑ 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)

Showcase


Quick Start

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);
        }
    }
}

Table of Contents


Why FastSIMD?

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

Key Features

  • πŸ” 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.

Real-World Use Cases

  • ⚑ 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.

Performance Benchmarks

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

API Quick Reference

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

Technical Demos & Benchmarks

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.

Installation

Option 1: Maven (Recommended)

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>

Option 2: Gradle (via JitPack)

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'
}

Option 3: Direct Download (No Build Tool)

Download the latest JARs directly to add them to your classpath:

  1. ⚑ FastSIMD-0.1.3.jar (Hardware Vector Engine)
  2. πŸ’Ύ FastMemory-0.1.1.jar (32-Byte Aligned Allocator)
  3. πŸ“ FastPointer-0.1.1.jar (Native Primitive Pointer)
  4. βš™οΈ fastcore-0.1.0.jar (Mandatory Native Loader)

Important

All JARs must be in your classpath for the JNI calls to function correctly.


Documentation

  • 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 Support

Platform Status
Windows 10/11 (AVX2 / x64) βœ… Fully Supported
Linux (AVX2 / x64) 🚧 Planned
macOS (Apple Silicon NEON) 🚧 Planned

Related Projects

  • 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

License

MIT License β€” See LICENSE for details.


Part of the FastJava Ecosystem β€” Making the JVM faster. Small package. Maximum speed. Zero bloat. πŸš€πŸ“‹

About

🏎️ Unified hardware vector acceleration engine (AVX2, AVX-512, NEON) for Java.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages