diff --git a/CHANGELOG.md b/CHANGELOG.md index 43c97fd..e3250ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Filter plugins check size before loading content into memory (prevents OOM on large inputs) +- Status page pre-allocates collections with known capacities (meta plugins, compression info) - `#[inline]` on HTML escape helper functions (`esc`, `esc_attr`) for hot path performance - Removed `once_cell` crate (replaced with `std::sync::LazyLock` from Rust 1.80) - Removed `lazy_static` crate (replaced with `std::sync::LazyLock`) diff --git a/src/common/status.rs b/src/common/status.rs index f3615ba..0db7ec6 100644 --- a/src/common/status.rs +++ b/src/common/status.rs @@ -89,7 +89,7 @@ pub fn generate_status_info( }; let _default_type = crate::compression_engine::default_compression_type(); - let mut compression_info = Vec::new(); + let mut compression_info = Vec::with_capacity(CompressionType::iter().count()); // Sort compression types by their string representation let mut sorted_compression_types: Vec = CompressionType::iter().collect(); @@ -141,7 +141,8 @@ pub fn generate_status_info( }); } - let mut meta_plugins_map = std::collections::HashMap::new(); + let mut meta_plugins_map = + std::collections::HashMap::with_capacity(MetaPluginType::iter().count()); let mut enabled_meta_plugins_vec = Vec::new(); // Sort meta plugin types by their string representation to avoid creating plugins just for sorting