Remove inaccurate "zero-{copy,allocation}" claims
This commit is contained in:
6
style.md
6
style.md
@@ -99,7 +99,7 @@ auto addr = reinterpret_cast<uintptr_t>(ptr); // Pointer to integer conv
|
||||
- **Complexity must be justified with benchmarks** - measure performance impact before adding complexity
|
||||
- **Strive for 0% CPU usage when idle** - avoid polling, busy waiting, or unnecessary background activity
|
||||
- Use **inline functions** for performance-critical code (e.g., `allocate_raw`)
|
||||
- **Zero-copy operations** with `std::string_view` over string copying
|
||||
- **String views** with `std::string_view` to minimize unnecessary copying
|
||||
- **Arena allocation** for efficient memory management (~1ns vs ~20-270ns for malloc)
|
||||
|
||||
### Complexity Control
|
||||
@@ -249,7 +249,7 @@ private:
|
||||
- **Parameter passing:**
|
||||
- Pass by value for types ≤ 16 bytes (int, pointers, string_view, small structs)
|
||||
- Pass by const reference for types > 16 bytes (containers, large objects)
|
||||
- **Return by value** for small types (≤ 16 bytes), **string_view** for zero-copy over strings
|
||||
- **Return by value** for small types (≤ 16 bytes), **string_view** to avoid copying strings
|
||||
- **noexcept specification** for move operations and non-throwing functions
|
||||
```cpp
|
||||
std::span<const Operation> operations() const { return operations_; }
|
||||
@@ -307,7 +307,7 @@ for (auto &precondition : preconditions_) {
|
||||
|
||||
### Ownership & Allocation
|
||||
- **Arena allocators** for request-scoped memory with **STL allocator adapters** (see Performance Focus section for characteristics)
|
||||
- **String views** pointing to arena-allocated memory for zero-copy operations
|
||||
- **String views** pointing to arena-allocated memory to avoid unnecessary copying
|
||||
- **STL containers with arena allocators require default construction after arena reset** - `clear()` is not sufficient
|
||||
```cpp
|
||||
// STL containers with arena allocators - correct reset pattern
|
||||
|
||||
Reference in New Issue
Block a user