Skip to content

Commit b90ffa6

Browse files
committed
docs: correct zero-alloc claims to near-zero (fasthttp []byte→string conversions)
1 parent 0fd9649 commit b90ffa6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,14 @@ Measured on Apple M2 Pro (`go test -bench=. -benchtime=5s`):
158158

159159
### Key design decisions
160160

161-
- **fasthttp engine**: Built on [fasthttp](https://github.com/valyala/fasthttp)zero-alloc request handling with pre-allocated per-connection buffers. No per-request allocations on the hot path.
161+
- **fasthttp engine**: Built on [fasthttp](https://github.com/valyala/fasthttp) — pre-allocated per-connection buffers with near-zero allocation hot path. Cache hits bypass all string formatting; headers are pre-computed at cache-population time.
162162
- **`tcp4` listener**: IPv4-only listener eliminates dual-stack overhead on macOS/Linux — a 2× throughput difference vs `"tcp"`.
163163
- **Preload at startup**: `preload = true` reads all eligible files into RAM before the first request — eliminating cold-miss latency.
164164
- **Direct `ctx.SetBody()` fast path**: cache hits bypass range/conditional logic entirely; pre-formatted `Content-Type` and `Content-Length` headers are assigned directly.
165165
- **Custom Range implementation**: `parseRange()`/`serveRange()` handle byte-range requests without `http.ServeContent`.
166166
- **Post-processing compression**: compress middleware runs after the handler, compressing the response body in a single pass.
167167
- **Path-safety cache**: `sync.Map`-based cache eliminates per-request `filepath.EvalSymlinks` syscalls. Pre-warmed from preload.
168-
- **GC tuning**: `gc_percent = 400` reduces garbage collection frequency — the hot path is allocation-free.
168+
- **GC tuning**: `gc_percent = 400` reduces garbage collection frequency — the hot path avoids all formatting allocations, with only minimal byte-to-string conversions from fasthttp's `[]byte` API.
169169
- **Cache-before-stat**: `os.Stat` is never called on a cache hit — the hot path is pure memory.
170170
- **Zero-alloc `AcceptsEncoding`**: walks the `Accept-Encoding` header byte-by-byte without `strings.Split`.
171171
- **Pre-computed `ETagFull`**: the `W/"..."` string is built when the file is cached.

docs/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"In-memory LRU cache with ~28 ns/op lookup",
9797
"Startup preloading with path-safety cache pre-warming",
9898
"TTL-aware cache expiry with optional automatic stale-entry eviction",
99-
"Direct ctx.SetBody() zero-alloc fast path for cache hits",
99+
"Direct ctx.SetBody() fast path with pre-formatted headers for cache hits",
100100
"HTTP/2 with automatic HTTPS",
101101
"TLS 1.2+ with AEAD cipher suites",
102102
"gzip and brotli compression",
@@ -234,7 +234,7 @@ <h1 class="hero-title">static-web</h1>
234234
</div>
235235
<div class="stat-divider" aria-hidden="true"></div>
236236
<div class="stat">
237-
<span class="stat-value">0 alloc</span>
237+
<span class="stat-value">~0 alloc</span>
238238
<span class="stat-label">hot-path serving</span>
239239
</div>
240240
<div class="stat-divider" aria-hidden="true"></div>
@@ -299,8 +299,8 @@ <h2 class="section-title" id="features-heading">Everything You Need</h2>
299299
<div class="features-grid">
300300
<div class="feature-card">
301301
<div class="feature-icon"></div>
302-
<h3>Zero-Alloc Hot Path</h3>
303-
<p><strong>~141k req/sec</strong> — 55% faster than Bun. Built on fasthttp with direct <code>ctx.SetBody()</code> and pre-formatted headers — zero allocations on the hot path.</p>
302+
<h3>Near-Zero Alloc Hot Path</h3>
303+
<p><strong>~141k req/sec</strong> — 55% faster than Bun. Built on fasthttp with direct <code>ctx.SetBody()</code> and pre-formatted headers — no formatting allocations on cache hits.</p>
304304
</div>
305305
<div class="feature-card">
306306
<div class="feature-icon">🗜️</div>

0 commit comments

Comments
 (0)