chopin

TechEmpower Benchmark Compliance Guide

Chopin is designed for extreme performance, often achieving numbers that might look “too good to be true.” To ensure your Chopin implementation is classified as Realistic (and not Stripped) by the TechEmpower Framework Benchmarks (TFB) project, follow the guidelines in this document.


1. What is “Realistic” vs “Stripped”?

In TFB rules, an implementation is marked as Stripped if it cuts corners that a production-grade framework wouldn’t. This includes:

Chopin provides high-performance paths for all of these that are 100% compliant with the “Realistic” classification.


2. Rule-by-Rule Compliance in Chopin

A. HTTP Headers (Date & Server)

B. Request Routing

C. JSON Serialization

D. Single/Multiple Queries (ORM vs Raw)


To achieve 10M+ req/s on Plaintext while remaining “Realistic,” use the following patterns:

Plaintext (Test #6)

#[get("/plaintext")]
fn plaintext(_ctx: Context) -> Response {
    // Realistic: headers are dynamic, body is a static slice.
    Response::text_static(b"Hello, World!")
}

JSON (Test #1)

#[get("/json")]
fn json(_ctx: Context) -> Response {
    // Realistic: Object instantiation + SIMD serialization per request.
    Response::json(&Message { message: "Hello, World!" })
}

Database (Test #2)

#[get("/db")]
fn db(_ctx: Context) -> Response {
    let id = rand_id();
    // Realistic: DB Pool checkout + single query + ORM mapping.
    let row = conn.query_one("SELECT id, randomnumber FROM world WHERE id = $1", &[&id])?;
    Response::json(&World::from_row(row))
}

4. Optimization Checklists

Optimization Realistic Stripped Status in Chopin
io_uring backend   Standard Linux feature
SIMD JSON (kowito-json)   Standard Rust library
Pipelined I/O Batching   Standard server optimization
Dynamic Date Headers   Standard framework behavior
Hardcoded Status Lines   Avoid Response::raw
Manual TCP write bypassing router   Always use #[get]

Summary

The goal of Chopin is to provide the fastest possible realistic framework. By using our standard macros (#[get]) and builders (Response::json), you get all the performance of a handwritten C server while keeping the code clean, maintainable, and fully compliant with all TechEmpower rules.