-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Use Case / Motivation
Improve the performance of the base library and ensure consistency in coding style.
Proposed Implementation
| Category | Legacy / STL | Recommended Alternative | Benefits / Optimization Points |
|---|---|---|---|
| Containers | std::unordered_map | absl::flat_hash_map | Better memory usage and throughput; Abseil’s Swiss table is cache-friendly and often significantly faster than std::unordered_map.(Abseil) |
| Strings | std::stringstream / + | absl::StrCat / absl::StrJoin | Reduces allocations by pre-computing lengths and avoids temporary string creation, leading to faster concatenation.(php.cn) |
| Synchronization Primitives | std::mutex | absl::Mutex | Abseil’s Mutex can have better uncontended performance and richer features (e.g., deadlock detection and advanced waiting conditions).(AI Coding Community) |
| Async / Future | std::future | folly::Future / folly::SemiFuture | Supports continuation chaining (.then()), executors, and more expressive async composition than the basic C++ std::future.(DeepWiki) |
| Memory / Large Strings | std::vector (or naive buffers) | absl::Cord | Efficient handling of large/fragmented strings or data streams, minimizes copying, and can chain data segments.(AI Coding Community) |
| Error Handling | bool / int status codes | absl::StatusOr | Strongly typed status with return value; forces error checking and makes failure handling safer.(AI Coding Community) |
| Concurrent Queue | std::queue + std::mutex | folly::MPMCQueue | Lock-free or low-overhead multi-producer, multi-consumer queue; better throughput under high concurrency.(php.cn) |
Alternatives Considered
No response
Reactions are currently unavailable
Metadata
Metadata
Labels
enhancementNew feature or requestNew feature or request