Sitelet https://github.com/winnow-rs/winnow/commit/1b9c86affa5c83ee8b25713a2e8e2ddde10518d2
Skip to content

Commit 1b9c86a

Browse files
committed
docs(design): Cover performance
1 parent e30e516 commit 1b9c86a

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎DESIGN.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,25 @@ Guidelines
7070

7171
See also
7272
- [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/checklist.html)
73+
74+
## Performance
75+
76+
Keep the code simple unless a real-world benchmark shows benefits to a more complicated design.
77+
Microbenchmarks are not always sufficient as performance can vary from real-world cases.
78+
79+
### Limit code generation for tuples
80+
81+
Implementing traits for tuples can generate a lot of code.
82+
83+
Limit trait implementations for tuples to 10 elements.
84+
85+
Identify if a non-generic core can be split out.
86+
87+
Consider alternatives, like macros.
88+
89+
### Inlined wrapper around specialized cores
90+
91+
The compiler does not always make the right inlining decisions that can lead to optimizations.
92+
One way of helping the compiler is to have a very thin `#[inline(always)]` wrapper that
93+
dispatches to one of several function bodies
94+
(whether syntactically or through monomorphization).

0 commit comments

Comments
 (0)