fasthttp: pin V to latest + cut per-request allocation (default GC)#918
Draft
enghitalo wants to merge 2 commits into
Draft
fasthttp: pin V to latest + cut per-request allocation (default GC)#918enghitalo wants to merge 2 commits into
enghitalo wants to merge 2 commits into
Conversation
Contributor
Author
|
/benchmark -f fasthttp |
Contributor
|
👋 |
Contributor
Benchmark ResultsFramework:
Full log |
The study (V_GC_TLA_STUDY.md) showed fasthttp's json path is GC-collection-bound, so
fewer per-request allocations = less Boehm STW = more throughput, with bounded memory.
Three output-identical changes:
- content_owned: true on every response → the backend takes the builder buffer instead
of cloning it (take_or_clone_content), removing one alloc per response.
- zero-copy routing: method/target/route as tos() views into the request buffer instead
of bytestr()/all_before() copies.
- parse_u_at for the /json/{count} segment instead of route[6..].i64() (no substring).
Functionally validated end-to-end against Postgres (pipeline/baseline/json/async-db/upload).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
/benchmark -f fasthttp |
Contributor
|
👋 |
Contributor
Benchmark ResultsFramework:
Full log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pin the V toolchain used by frameworks/fasthttp from c0624b274 to the latest upstream V master commit 6c4d26f1f for reproducible and up-to-date benchmark builds.
Why this can improve benchmark results
This update pulls in recent upstream V changes that are directly relevant to runtime behavior under load:
a << x), fixes #27468 vlang/v#27470<<) 4-7x slower on master vs 0.5.1 (alloc, push_many, indexed-write unaffected) vlang/v#27468.Closed issue references
<<) 4-7x slower on master vs 0.5.1 (alloc, push_many, indexed-write unaffected) vlang/v#27468 (fixed by PR #27470)Scope
Update: also reduce per-request allocation (default GC, no
-gc none)Following the GC study (
V_GC_TLA_STUDY.md), fasthttp'sjsonpath isGC-collection-bound, so fewer per-request allocations = less Boehm stop-the-world =
more throughput, with bounded memory. Three output-identical changes:
content_owned: trueon every response → the backend takes the response builder'sbuffer instead of cloning it (
take_or_clone_content), removing one alloc per response.tos()views into the request bufferinstead of
bytestr()/all_before()copies.parse_u_atfor the/json/{count}segment instead ofroute[6..].i64()(no substring).Functionally validated end-to-end against Postgres (pipeline / baseline / json / async-db
/ upload). No
-gc none.