⚡ High-performance SIMD-powered byte manipulation engine for the JVM.
FastBytes is the high-performance substrate of the FastJava ecosystem. It provides 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.
Watch the Demo | Watch JMH Benchmark (YouTube)
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.");
}
}- Quick Start
- Why FastBytes?
- Key Features
- Real-World Use Cases
- Performance Benchmarks
- API Quick Reference
- Technical Demos & Benchmarks
- 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 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.
FastBytes replaces scalar JVM byte processing with vectorized hardware primitives:
| Feature | Java java.util.Arrays |
Guava Bytes Utility |
FastBytes |
|---|---|---|---|
Search Engine (indexOf) |
Scalar loop (1 byte / cycle) | Linear loop search | AVX-512 / AVX2 (32–64 Bytes / Cycle) |
| Bitwise Frame XOR (4K) | ~52 ms (Java loop) | N/A (Not supported) | ~2 ms (26x Hardware Vectorized) |
| Array Boundary Checks | Enforced on every byte | Enforced on every byte | Branchless Native Unrolled Blocks |
| Endianness Byte Swap | Manual bit-shift loop | Bitwise utility loop | Vectorized In-Place Byte Shuffle |
| Heap Allocations | Transient copy arrays | Wrapper objects | 0 Heap Allocations (In-Place Memory) |
| Dependencies | JDK standard lib | Heavy Guava JAR (~3 MB) | Pure Java 17+ backed by FastCore |
- ⏱️ SIMD Copy: Up to 10x faster than
System.arraycopyfor large memory blocks. - 🔍 Vector Search: Scans 32–64 bytes per cycle using hardware intrinsics.
- ⚙️ Native XOR: Optimized for cryptographic operations 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 and memory operations. In the official JMH Benchmark, the system measured AVX2 256-bit byte matching and bitwise XOR stream transformations:
Benchmark Mode Cnt Score Error Units
Benchmark.testFastBytesSearch thrpt 3 284100.850 ops/s
284,000+ Packet Scans per Second:
FastBytesevaluates binary network payloads at native hardware bus speeds with zero heap buffer allocations.
| 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 |
| Method | Return Type | Description | Docs |
|---|---|---|---|
FastBytes.indexOf(data, byte) |
int |
AVX-512 / AVX2 accelerated byte scanner (32-64 bytes/cycle). | Reference |
FastBytes.copy(src, spos, dst, dpos, len) |
void |
High-speed memory migration (64-byte unrolled with prefetching). | Reference |
FastBytes.xor(a, b, out) |
void |
128-byte unrolled vector XOR transformation engine. | Reference |
FastBytes.fill(array, value) |
void |
Rapid buffer zeroing and value initialization. | Reference |
FastBytes.compare(a, b) |
int |
Vectorized comparison with hardware mismatch detection. | Reference |
FastBytes.hashXXH32(data, seed) |
int |
SIMD-ready xxHash32 non-cryptographic checksum. | Reference |
FastBytes.swapBytes(array, groupSize) |
void |
In-place byte swapping for endianness conversion. | Reference |
FastBytes.secureZero(array) |
void |
Compiler-barrier protected memory sanitization. | Reference |
| Case | Java Example | Launcher | Description |
|---|---|---|---|
| Unified Speed Race Demo | Demo.java | run-demo.bat |
Interactive speed race benchmarking Search, Copy, Fill, Hash, and 4K XOR operations against standard Java. |
| JMH Microbenchmark Suite | Benchmark.java | run-benchmark.bat |
Comprehensive OpenJDK JMH benchmark measuring vector throughput for Search, Copy, Fill, Hash, and XOR. |
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.
- 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 (x64) | âś… Fully Supported |
| Linux | đź”— Planned |
| macOS | đź”— Planned |
- 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
MIT License — See LICENSE file for details.
Part of the FastJava Ecosystem — Making the JVM faster. 🚀
