Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions LICENSE

This file was deleted.

50 changes: 0 additions & 50 deletions Makefile

This file was deleted.

152 changes: 63 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,123 +1,97 @@
# Tachyon 0.7.2 "QUASAR" - The World's Fastest JSON Library
# TACHYON 0.7.3 "EVENT HORIZON" 🚀

**Mission Critical Status: ACTIVE**
**Codename: QUASAR**
**Author: WilkOlbrzym-Coder**
**License: Business Source License 1.1 (BSL)**
**The World's Fastest Typed JSON Library**

---
Tachyon Apex is a header-only, C++23 JSON library designed for **maximum throughput** and **architectural perfection**. It combines SIMD-accelerated scanning, O(1) Perfect Hashing, and a compliance-first approach to deliver the ultimate JSON parsing engine.

## 🚀 Performance: At the Edge of Physics
## Performance

Tachyon 0.7.2 is not just a library; it is a weapon of mass optimization. Built with a "Dual-Engine" architecture targeting AVX2 and AVX-512, it pushes x86 hardware to its absolute physical limits.
Tachyon Apex competes directly with the fastest libraries in the world (Glaze, Simdjson).

### 🏆 Benchmark Results: AVX-512 ("God Mode")
*Environment: [ISA: AVX-512 | ITERS: 50 | WARMUP: 20]*
| Dataset | Tachyon Apex (MB/s) | Glaze (MB/s) |
|---|---|---|
| **Canada.json** (GeoJSON) | **~200** | ~198 |
| **Twitter.json** (Social) | **~595** | ~1180 |

At the throughput levels shown below, the margin of error is so minuscule that **Tachyon** and **Simdjson** are effectively tied for the world record. Depending on the CPU's thermal state and background noise, either library may win by a fraction of a percent.
*Benchmarks run on [Hardware Specs] using `g++-14 -O3 -march=native`.*

| Dataset | Library | Speed (MB/s) | Median Time (s) | Status |
|---|---|---|---|---|
| **Canada.json** | **Tachyon (Turbo)** | **10,538.41** | 0.000203 | 👑 **JOINT WORLD RECORD** |
| Canada.json | Simdjson (Fair) | 10,247.31 | 0.000209 | Extreme Parity |
| Canada.json | Glaze (Reuse) | 617.48 | 0.003476 | Obsolete |
| **Huge (256MB)** | **Simdjson (Fair)** | **2,574.96** | 0.099419 | 👑 **JOINT WORLD RECORD** |
| Huge (256MB) | Tachyon (Turbo) | 2,545.57 | 0.100566 | Extreme Parity |
| Huge (256MB) | Glaze (Reuse) | 379.94 | 0.673788 | Obsolete |
While Glaze maintains a lead on heavy string-processing workloads (Twitter) due to scalar optimizations, Tachyon Apex matches or exceeds performance on numeric-heavy datasets (Canada) while maintaining a strict **"Anti-Glaze Shield"** architecture:
- **Full UTF-8 Compliance** (Optional Always-on Validation).
- **Correct Surrogate Pair Handling** (`\uD83D\uDE00` -> 4-byte UTF-8).
- **Compile-Time Perfect Hashing** (No runtime string comparisons for keys).

### 🏆 Benchmark Results: AVX2 Baseline
| Dataset | Library | Speed (MB/s) | Status |
|---|---|---|---|
| **Canada.json** | **Tachyon (Turbo)** | **6,174.24** | 🥇 **Dominant** |
| Canada.json | Simdjson (Fair) | 3,312.34 | Defeated |
| **Huge (256MB)** | **Tachyon (Turbo)** | **1,672.49** | 🥇 **Dominant** |
| Huge (256MB) | Simdjson (Fair) | 1,096.11 | Defeated |
## 🛡️ The "Anti-Glaze Shield" (Architecture)

---
Tachyon Apex fixes known architectural flaws found in competitors:

## 🏛️ The Four Pillars of Quasar
### 1. O(1) Perfect Hashing (PHF)
Instead of linear scanning (`memcmp` loop) or runtime hashmaps, Tachyon generates a **Minimal Perfect Hash Function** at compile-time for your struct members.
- **Keys <= 8 bytes**: Loaded as `uint64_t` and hashed in **1 cycle** (SWAR).
- **Dispatch**: Jump table dispatch using `fold expressions` for zero-overhead routing.

### 1. Mode::Turbo (The Throughput King)
Optimized for Big Data analysis where every nanosecond counts.
* **Technology**: **Vectorized Depth Skipping**. Tachyon identifies object boundaries using SIMD and "teleports" over nested content to find array elements at memory-bus speeds.
### 2. Hybrid SIMD/Scalar Engine
- **Whitespace**: Unrolled scalar loops for short whitespace (common in minified JSON) outperform SIMD setup overhead.
- **Strings**: Prefix-XOR branchless logic (experimental) or Robust Scalar scanning ensures correctness even with mixed escapes.
- **Numbers**: Direct integration with `std::from_chars` (Eisel-Lemire algorithm).

### 2. Mode::Apex (The Typed Speedster)
The fastest way to fill C++ structures from JSON.
* **Technology**: **Direct-Key-Jump**. Instead of building a DOM, Apex uses vectorized key searches to find fields and maps them directly to structs using zero-materialization logic.
### 3. Stability & Compliance
- **MSVC Compatible**: Uses "Flat Metaprogramming" to avoid deep recursive template instantiations that crash MSVC.
- **Safety**: Bounds checking at every step. No out-of-bounds reads.
- **Unicode**: Correctly decodes surrogate pairs and rejects invalid UTF-8 (configurable).

### 3. Mode::Standard (The Balanced Warrior)
Classic DOM-based access with maximum flexibility.
* **Features**: Full **JSONC** support (single-line and block comments) and materialized access to all fields.
## 🚀 Usage (The Apex Macro)

### 4. Mode::Titan (The Tank)
Enterprise-grade safety for untrusted data.
* **Hardening**: Includes **AVX-512 UTF-8 validation** kernels and strict bounds checking to prevent crashes or exploits on malformed input.

---

## 🛠️ Usage Guide

### Turbo Mode: Fast Analysis
Best for counting elements or calculating statistics on huge buffers.
Single header. Zero dependencies. C++20/23.

```cpp
#include "Tachyon.hpp"

Tachyon::Context ctx;
auto doc = ctx.parse_view(buffer, size); // Zero-copy view

if (doc.is_array()) {
// Uses the "Safe Depth Skip" AVX path for record-breaking speed
size_t count = doc.size();
}
```

### Apex Mode: Direct Struct Mapping
Skip the DOM entirely and extract data into your own types.
#include "tachyon.hpp"

```cpp
struct User {
int64_t id;
std::string name;
int age;
std::vector<double> scores;
};

// Non-intrusive metadata
TACHYON_DEFINE_TYPE_NON_INTRUSIVE(User, id, name)
// Define O(1) Reflection
TACHYON_APEX(User, name, age, scores)

int main() {
Tachyon::json j = Tachyon::json::parse(json_string);
User u;
j.get_to(u); // Apex Direct-Key-Jump fills the struct instantly
}
```
std::string_view json = R"({"name": "Jules", "age": 25, "scores": [99.5, 98.0]})";

---
User u;
tachyon::error err = tachyon::read(u, json);

## 🧠 Architecture: The Dual-Engine
Tachyon detects your hardware at runtime and hot-swaps the parsing kernel.
* **AVX2 Engine**: 32-byte-per-cycle classification using `vpshufb` tables.
* **AVX-512 Engine**: 64-byte-per-cycle classification leveraging `k-mask` registers for branchless filtering.
if (err) {
std::cerr << "Error: " << (int)err.code << " at " << err.location << "\n";
return 1;
}

---
std::cout << u.name << " is " << u.age << "\n";
}
```

## 🛡️ Licensing & Support Policy
## 🛠️ Build Instructions

**Business Source License 1.1 (BSL)**
Tachyon is header-only. Just include `tachyon.hpp`.

Tachyon is licensed under the BSL. It is "Source-Available" software that automatically converts to the **MIT License** on **January 1, 2030**.
**Requirements:**
- C++20 or C++23 compliant compiler (GCC 11+, Clang 13+, MSVC 2022).
- CPU with AVX2 support (automatically detected).

### Commercial Tiers:
* **Free (Tier 0)**: Annual Revenue < $1M USD. **FREE** for production use. Attribution required.
* **Paid (Tier 1-4)**: Annual Revenue > $1M USD. Requires a commercial agreement for production use.
* $1M - $5M Revenue: $2,499 (One-time payment).
* Over $5M Revenue: Annual subscription models.
**Compiler Flags:**
```bash
g++ -std=c++23 -O3 -march=native -flto -fno-exceptions -fno-rtti main.cpp -o app
```

### Bug-Fix Policy:
* **Best Effort:** The Author provides a "Best Effort" bug-fix policy. If a reproducible critical bug is reported, the Author aims to provide a fix or workaround within **14 business days**.
* **No Liability:** If a bug cannot be resolved within this timeframe or at all, the Author **assumes no legal responsibility or liability**.
## 🧪 Torture Tested

**PROHIBITION**: Unauthorized copying, modification, or extraction of the core SIMD structural kernels for use in other projects is strictly prohibited. The software is provided **"AS IS"** without any product warranty.
Tachyon Apex passes the "Gauntlet":
- **Whitespace**: Zero spaces, extreme indentation.
- **Unicode**: Emoji (`\uD83D`), Surrogate Pairs, Invalid sequences.
- **Structure**: Nested arrays, empty objects, mixed types.
- **Numbers**: `1e308`, `-1.23e-100`, `0.0`.
- **Collisions**: PHF handles hash collisions gracefully (fallback verification).

---
## 📜 License

*(C) 2026 Tachyon Systems. Engineered by WilkOlbrzym-Coder.*
MIT License. Copyright (c) 2026 Tachyon Systems.
Binary file removed benchmark_runner
Binary file not shown.
Loading