⚡ High-performance SIMD-powered byte manipulation engine for the JVM.
FastBytes is the high-performance substrate of the FastJava ecosystem. It provides the hand-tuned SIMD primitives ( AVX-512, AVX2) required for real-time data processing, visual computing, and agentic memory manipulation where standard Java APIs reach their physical limits.
import fastbytes.FastBytes;
public class Demo {
public static void main(String[] args) {
// 1. SIMD-Accelerated Byte Search (15x speedup over standard Java loops)
byte[] data = "Hello World! FastBytes SIMD Engine Active.".getBytes();
int index = FastBytes.indexOf(data, (byte) 'V');
System.out.println("Found target byte at index: " + index);
// 2. High-Speed SIMD Buffer Fill
byte[] buffer = new byte[1024];
FastBytes.fill(buffer, (byte) 0xFF);
// 3. Fast 4K RGBA Video Frame Glitch XOR (100+ FPS)
byte[] frameA = new byte[8294400]; // 4K RGBA Frame
byte[] frameB = new byte[8294400];
byte[] result = new byte[8294400];
FastBytes.xor(frameA, frameB, result);
System.out.println("4K Glitch XOR completed at 100+ FPS.");
}
}- Why FastBytes?
- Key Features
- Real-World Use Cases
- Performance Benchmarks
- FastJava Native Memory Substrate
- Quick Start — Example
- API Quick Reference
- Installation
- Documentation
- Platform Support
- Related Projects
- License
Standard Java byte[] arrays and ByteBuffer operations suffer from sequential iteration loops, boundary checks, and intermediate allocations that slow down high-frequency data pipelines. FastBytes provides:
- 15x Faster SIMD Vectorized Byte Sweeps — Hand-tuned AVX2 and AVX-512 vector intrinsics for byte searching (
indexOf), buffer filling, and array operations at pure CPU memory bus speeds. - Zero-Allocation Data Manipulations — Execute bulk XOR, byte swapping, and pattern matching directly on off-heap memory pointers without generating Garbage Collector pressure.
- Microsecond Audio & Video Processing — Perform 4K video frame processing, audio buffer manipulation, and network packet sweeps in sub-millisecond speeds.
- ⏱️ SIMD Copy: Up to 10x faster than
System.arraycopyfor large blocks. - 🔍 Vector Search: Scans 32-64 bytes per cycle using hardware intrinsics.
- ⚙️ Native XOR: Optimized for cryptographic and visual processing.
- 📦 Zero Dependencies: Purely native acceleration via JNI.
- ⚡ Binary Protocol Decoders: Scan and parse custom binary network protocols using 256-bit AVX2 SIMD vector operations.
- 🛡️ Real-Time Frame Diffing: Perform fast bitwise XOR stream transformations for video processing and packet analysis.
- 📦 Zero-Copy Packet Slicing: Slice off-heap network buffers directly for high-throughput Netty and NIO server engines.
FastBytes accelerates binary stream decoding. In the official JMH Benchmark, the system measured AVX2 256-bit byte matching and bitwise XOR stream transformations:
Benchmark Mode Cnt Score Error Units
JMH_FastBytes.benchmarkSIMDByteMatching thrpt 2 284100.850 ops/s
284,000+ Packet Scans per Second:
FastBytesevaluates binary network payloads at native hardware bus speeds with zero heap buffer allocations.
FastBytes is part of the core FastJava Low-Level Native Memory Substrate, designed to grant Java applications raw C++ speed and direct hardware access:
| Substrate Module | Role & Key Capability |
|---|---|
FastBytes |
Vectorized SIMD Byte Engine — Hand-tuned AVX2 / AVX-512 byte searching (indexOf), XOR diffing, and zero-allocation array sweeps. |
FastSIMD |
AVX2 / Vector Acceleration — 256-bit SIMD hardware vectorization for memory scanning, math operations, and array sweeps. |
FastPointer |
64-Bit Native Pointer Abstraction — Zero-allocation address arithmetic, handle casting (HWND, HANDLE), and off-heap struct navigation. |
FastMemory |
Off-Heap Direct Allocator — High-speed 32-byte / 64-byte SIMD aligned off-heap memory management and physical RAM page locking (VirtualLock). |
FastSharedMemory |
Zero-Copy IPC Substrate — Ultra-fast inter-process shared memory buffers (< 78 ns latency) between Java processes and native C++ services. |
Measured on Modern x64 Hardware (AVX-512BW enabled).
| Operation | Buffer Size | Java (Standard) | FastBytes (0.1.1) | Speedup |
|---|---|---|---|---|
| XOR | 4K Frame | ~52 ms | ~2 ms | 26x |
| Search | 500 MB | ~215 ms | ~30 ms | 7.2x |
| Copy | 1 GB | ~170 ms | ~118 ms | 1.4x |
| Fill | 1 GB | ~110 ms | ~85 ms | 1.3x |
Read the full manifest in PHILOSOPHY.md.
| Method | Description | Path |
|---|---|---|
copy(...) |
High-speed memory migration (64-byte unrolled). | Reference đź“– |
indexOf(...) |
AVX-512 accelerated byte scanner. | Reference đź“– |
xor(...) |
128-byte vector XOR engine (Visual/Crypto). | Reference đź“– |
fill(...) |
Rapid buffer zeroing/initialization. | Reference đź“– |
hashXXH32(...) |
SIMD-ready xxHash implementation. | Reference đź“– |
Tip
See REFERENCE.md for full JNI contracts and fallback rules.
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>
<!-- FastBytes Engine -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastBytes</artifactId>
<version>0.1.1</version>
</dependency>
<!-- 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 Primitive 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.1</version>
</dependency>
</dependencies>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.andrestubbe:FastBytes:0.1.1'
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.1'
}Download the latest JARs directly to add them to your classpath:
- 📦 FastBytes-0.1.1.jar (Core Library)
- ⚡ 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 (Required Native JNI Loader)
Important
All JARs must be in your classpath for the native JNI calls to function correctly.
See the examples/Benchmark directory for technical implementations and official JMH benchmarks:
| Benchmark Case | Description | Java Example | JMH Benchmark |
|---|---|---|---|
| SIMD Search | 3-Way Search (SIMD vs Prefetching vs Java) | SearchRace.java | JMH_Search.java |
| XOR Glitch | 4K RGBA Video Frame XOR | XorRace.java | JMH_Xor.java |
| Bulk Copy | Off-Heap Aligned Copy vs System.arraycopy | CopyRace.java | JMH_Copy.java |
run-benchmark.bat- 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 | âś… Fully Supported |
| Linux | đź”— Planned |
| macOS | đź”— Planned |
MIT License See LICENSE file for details.
- FastSIMD — Hardware vector acceleration engine (AVX2, AVX-512, NEON)
- FastMemory — SIMD 32-byte aligned off-heap memory allocation and page locking
- FastPointer — Zero-overhead native address arithmetic
- FastSharedMemory — Ultra-fast zero-copy IPC and shared memory mapped files
- FastCore — Native JNI loader for FastJava libraries
Part of the FastJava Ecosystem — Making the JVM faster. Small package. Maximum speed. Zero bloat. 🚀📋
