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:
Alex Crichton
2017-07-10 13:15:02 -07:00
parent da0b53cc89
commit 6bf0a94cb1
+417 -619
View File
File diff suppressed because it is too large Load Diff