#![feature(test)] extern crate test; extern crate parsip; const REQ: &'static [u8] = b"\ INVITE sip:bob@biloxi.com SIP/2.0\r\n\ Via: SIP/2.0/UDP bigbox3.site3.atlanta.com;branch=z9hG4bK77ef4c2312983.1\r\n\ Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKnashds8;received=192.0.2.1\r\n\ Max-Forwards: 69\r\n\ To: Bob \r\n\ From: Alice ;tag=1928301774\r\n\ Call-ID: a84b4c76e66710\r\n\ CSeq: 314159 INVITE\r\n\ Contact: \r\n\ Content-Type: application/sdp\r\n\ Content-Length: 0\r\n\r\n"; #[bench] fn bench_parsip_request(b: &mut test::Bencher) { let mut headers = [parsip::Header { name: "", value: &[], }; 16]; let mut req = parsip::Request::new(&mut headers); b.iter(|| { assert_eq!(req.parse(REQ), parsip::IResult::Done(&b""[..], REQ.len())); }); b.bytes = REQ.len() as u64; }