Skip to content

Commit 75719ae

Browse files
authored
Merge pull request #213 from BennyFranciscus/docs/implementation-rules
docs: implementation rules for realistic benchmarks
2 parents e5dd213 + b67f064 commit 75719ae

2 files changed

Lines changed: 81 additions & 0 deletions

File tree

site/content/docs/add-framework/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Adding a framework to HttpArena takes a few steps: create a Dockerfile, add meta
99
{{< card link="directory-structure" title="Directory Structure" subtitle="How to organize your framework's files — Dockerfile, meta.json, and source code." icon="folder" >}}
1010
{{< card link="test-profiles" title="Test Profiles" subtitle="All HTTP endpoints your framework must implement, organized by test profile." icon="code" >}}
1111
{{< card link="meta-json" title="meta.json" subtitle="Framework metadata — display name, language, type, and which tests to participate in." icon="document-text" >}}
12+
{{< card link="implementation-rules" title="Implementation Rules" subtitle="Rules for keeping benchmarks realistic — use framework APIs, production settings only, standard libraries." icon="shield-check" >}}
1213
{{< card link="testing" title="Testing & Submitting" subtitle="How to validate your implementation locally and submit a pull request." icon="check-circle" >}}
1314
{{< card link="ci" title="CI & Runner" subtitle="GitHub Actions workflows and the self-hosted benchmark runner." icon="cog" >}}
1415
{{< /cards >}}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: Implementation Rules
3+
weight: 5
4+
---
5+
6+
These rules exist to keep HttpArena results meaningful and representative of real-world framework performance. They apply to all **framework-type** submissions and serve as a reference during PR reviews.
7+
8+
{{< callout type="info" >}}
9+
**Framework vs Engine entries:** HttpArena distinguishes between _framework_ entries (Express, Flask, Actix-web, etc.) and _engine_ entries (raw Node.js HTTP, CPython `http.server`, etc.). These rules apply to framework entries, where the goal is to measure what the framework gives you out of the box. Engine entries have more latitude since they _are_ the low-level layer — there is no higher-level API to bypass.
10+
{{< /callout >}}
11+
12+
## Benchmark the framework as people use it
13+
14+
All of the rules below follow one principle: **benchmark the framework the way developers actually use it in production.** If a typical team shipping a production API wouldn't make a particular choice, it doesn't belong in an HttpArena submission.
15+
16+
## Use framework-level APIs
17+
18+
If a framework provides a documented, high-level way to accomplish a task, the benchmark implementation **must** use it.
19+
20+
Bypassing the framework to hand-roll a faster solution is not permitted. HttpArena measures framework performance, not custom low-level implementations.
21+
22+
**Example — route parameter parsing:**
23+
24+
{{< tabs items="Good,Bad" >}}
25+
26+
{{< tab >}}
27+
```python
28+
# Use the framework's built-in parameter binding
29+
@app.get("/baseline")
30+
def baseline(a: int, b: int):
31+
return str(a + b)
32+
```
33+
{{< /tab >}}
34+
35+
{{< tab >}}
36+
```python
37+
# Manually parse query string for speed
38+
@app.get("/baseline")
39+
def baseline(request):
40+
qs = request.url.query.encode()
41+
a = fast_parse_int(qs, b"a=")
42+
b = fast_parse_int(qs, b"b=")
43+
return custom_serialize(a + b)
44+
```
45+
{{< /tab >}}
46+
47+
{{< /tabs >}}
48+
49+
**Why:** Users want to see how their framework performs with its own routing, serialization, and middleware. If the framework's built-in serializer is slow, that is valuable information. Bypassing it removes that signal and misrepresents actual framework performance.
50+
51+
## Settings must be production-documented
52+
53+
Non-default configuration is allowed **only if the framework's official production deployment guide recommends it**. If there is no official documentation recommending a setting for production use, it does not belong in the benchmark.
54+
55+
For example, you might want to adjust GC settings of Java or .NET applications as recommended in their production deployment guide, or set worker/thread counts to match available CPU cores.
56+
57+
**Not allowed:**
58+
- Undocumented flags found by reading framework source code
59+
- Experimental or unstable options that trade safety for speed
60+
- Settings that disable buffering, validation, or error handling
61+
62+
Any non-default setting should be traceable to the framework's official production deployment documentation. If a reviewer asks for a reference, the submitter should be able to provide one.
63+
64+
## Use standard libraries and drivers
65+
66+
If the ecosystem has a well-established, production-grade library for a task (database driver, JSON serializer, HTTP client), use it. Bringing in an experimental or hand-rolled alternative solely because it performs better in microbenchmarks is not permitted.
67+
68+
**Example:** If every production application in a given language uses `libpq` bindings for Postgres, substituting an experimental zero-copy driver that nobody ships to production is not appropriate.
69+
70+
**Exception:** If the framework itself bundles or officially recommends a specific library, that library is acceptable.
71+
72+
## Deployment-environment tuning
73+
74+
Adapting to the benchmark hardware is permitted:
75+
76+
- Setting worker count to match CPU cores
77+
- Configuring connection pool sizes
78+
- Adjusting memory limits for the container
79+
80+
The boundary is: **adapt to the environment, don't exploit it.**

0 commit comments

Comments
 (0)