mirror of
https://github.com/openharmony/third_party_rust_http.git
synced 2026-07-19 14:43:33 -04:00
Improve compile time of header name parsing
A simple test like this previously took about 3 seconds to compile on my
machine:
extern crate http;
fn main() {
use http::HeaderMap;
let mut map = HeaderMap::new();
assert!(map.get("x-hello").is_none());
map.insert("x-hello", "hello");
assert_eq!(map.get("x-hello").unwrap(), &"hello");
map.append("x-hello", "world");
assert_eq!(map.get("x-hello").unwrap(), &"hello");
}
The main problem here was that the `parse_hdr!` macro, which is huge and takes a
long time to compile, was being compiled multiple times locally. There's no need
for this function to get inlined across crates and this PR drops the
compile-time of the above snippet to 0.5s
This commit is contained in:
+417
-619
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user