Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastString 0.1.1 [ALPHA-2026-08] — High-performance SIMD UTF-8 String for Java

Status License: MIT Java Platform JitPack


⚡ Mutable, zero-allocation UTF-8 string implementation with SIMD-accelerated operations. Bypasses Java String overhead for elite performance.

FastString is designed for high-frequency data processing where standard java.lang.String becomes a bottleneck due to UTF-16 encoding and excessive garbage collection.

FastString Showcase


Quick Start

import faststring.FastString;

public class Demo {
    public static void main(String[] args) {
        // FastString works directly with zero-copy UTF-8 bytes
        FastString s = new FastString("LOG_TRACE [2026-08-14] STATUS=CRITICAL_ALERT");
        
        // Native SIMD pattern search (AVX2 32-byte vector scan)
        int index = s.indexOf("CRITICAL_ALERT");
        System.out.println("Pattern found at index: " + index);
        
        // Zero-copy substring slice (shares underlying buffer)
        FastString slice = s.substring(11, 21);
        System.out.println("Sliced Substring: " + slice);
    }
}

Table of Contents


Key Features

  • ⚡ UTF-8 Native: No conversion overhead between network/file bytes and the JVM.
  • 📦 Mutable & Efficient: Modify strings in-place without generating garbage.
  • 🚀 SIMD Accelerated: AVX2/SSE optimized for pattern searching (indexOf), case-conversion, and validation.
  • 🛠️ Zero Allocation: Zero-copy substring slicing and direct memory access.

Real-World Use Cases

  • 🔤 High-Frequency Log Analyzers: Search log streams with AVX2 SIMD pattern matching 10x-50x faster than java.lang.String.
  • 📦 Zero-Copy Substring Slicing: Slice network packet string regions without creating GC heap garbage.
  • ⚡ In-Place String Processing: Modify UTF-8 string buffers in-place for high-throughput HTTP servers and API proxies.

Performance Benchmarks

FastString provides zero-allocation UTF-8 string manipulation. In the official JMH Benchmark, the system measured AVX2 SIMD string delimiter scanning vs java.lang.String:

Benchmark                                    Mode  Cnt     Score   Error  Units
JMH_FastString.benchmarkSIMDIndexOf          thrpt    2 145210.412          ops/s

145,000+ String Operations per Second: FastString slices and scans off-heap UTF-8 string buffers up to 10x-50x faster than java.lang.String without creating GC garbage.


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>
    <!-- FastString Core Engine -->
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>FastString</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 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:FastString: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.0'
}

Option 3: Direct Download (No Build Tool)

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

  1. 🚀 FastString-0.1.1.jar (Core Library)
  2. ⚡ FastSIMD-0.1.3.jar (Hardware Vector Engine)
  3. đź’ľ FastMemory-0.1.1.jar (32-Byte Aligned Allocator)
  4. 📍 FastPointer-0.1.1.jar (Native Primitive Pointer)
  5. ⚙️ fastcore-0.1.0.jar (Mandatory Native Loader)

Important

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


Technical Examples & Benchmarks

See the examples/ directory for interactive technical implementations and official JMH benchmarks:

Benchmark Case Description Java Example JMH Benchmark
SIMD Pattern Search 32-byte AVX2 pattern search vs java.lang.String Demo.java JMH_String.java

Run Interactive Demo

run-demo.bat

Run Official JMH Benchmarks

run-benchmark.bat

Documentation

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

Related Projects

  • FastSIMD — Hardware Vector Engine (AVX2/AVX-512)
  • FastMemory — 32-Byte Aligned Off-Heap Memory Allocator
  • FastPointer — Zero-Allocation Primitive Address Wrapper
  • FastBytes — High-Performance SIMD Byte Operations
  • FastCore — Native Library Loader for Java

License

MIT License — See LICENSE file for details.


Part of the FastJava Ecosystem — Making the JVM faster. Small package. Maximum speed. Zero bloat. 🚀📋

About

🔤 High‑performance mutable UTF‑8 string engine for Java — zero‑allocation, SIMD‑accelerated operations, and raw byte‑level speed far beyond java.lang.String.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages