Skip to content

Commit f5f2da6

Browse files
author
Claude
committed
Move benchmark to benches/ folder
- benches/serde_validation.rs - benchmark source - benches/README.md - methodology and results documentation - Registered as example with custom path in Cargo.toml - Updated SERDE_INTEGRATION.md link to new location Run with: cargo run --example serde_bench --release --features serde,regex
1 parent 2921009 commit f5f2da6

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

domainstack/domainstack/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ required-features = ["regex"]
5353
name = "serde_validation"
5454
required-features = ["serde", "regex"]
5555

56+
[[example]]
57+
name = "serde_bench"
58+
path = "benches/serde_validation.rs"
59+
required-features = ["serde", "regex"]
60+
5661
[dev-dependencies]
5762
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }
5863
# Disable default features to avoid pulling in unnecessary database drivers (mysql, postgres)

domainstack/domainstack/docs/SERDE_BENCHMARK.md renamed to domainstack/domainstack/benches/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ Validation overhead is **~0.001%** of a typical API request.
138138
## Running the Benchmark
139139

140140
```bash
141-
cargo run --example serde_benchmark --release --features serde,regex
141+
cargo run --example serde_bench --release --features serde,regex
142142
```
143143

144-
The benchmark is located at: `domainstack/examples/serde_benchmark.rs`
144+
The benchmark source is: `benches/serde_validation.rs`
145145

146146
---
147147

domainstack/domainstack/examples/serde_benchmark.rs renamed to domainstack/domainstack/benches/serde_validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//!
66
//! Run with:
77
//! ```sh
8-
//! cargo run --example serde_benchmark --release --features serde,regex
8+
//! cargo run --example serde_bench --release --features serde,regex
99
//! ```
1010
1111
use std::time::{Duration, Instant};

domainstack/domainstack/docs/SERDE_INTEGRATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ fn validate_order(order: Order, user: &User) -> Result<(), ValidationErrors> {
158158
| **Boilerplate** | None | Must call `.validate()` |
159159
| **Flexibility** | Fixed rules | Context-aware rules |
160160
| **Partial data** | Not possible | Fully supported |
161-
| **Performance** | <2% overhead ([benchmarked](./SERDE_BENCHMARK.md)) | Zero overhead until called |
161+
| **Performance** | <2% overhead ([benchmarked](../benches/README.md)) | Zero overhead until called |
162162
| **Error type** | `serde::Error` wrapper | Native `ValidationErrors` |
163163
| **Testing** | Can't create invalid instances | Full control |
164164

0 commit comments

Comments
 (0)