1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Heap profile for `parse_message` + `to_bytes`.
//!
//! Run with:
//!
//! ```bash
//! cargo run --release --features dhat -p rvoip-sip --example profiling_dhat_parse
//! ```
//!
//! Emits `dhat-heap.json` in the CWD. Open at
//! <https://nnethercote.github.io/dh_view/dh_view.html>.
//!
//! Gated behind `--features dhat` so the global allocator swap never
//! leaks into `cargo test` runs.
use parse_message;
use black_box;
static ALLOC: Alloc = Alloc;
const ITERATIONS: usize = 50_000;
const INVITE: & = b"INVITE sip:bob@biloxi.example.com SIP/2.0\r\n\
Via: SIP/2.0/UDP pc33.atlanta.example.com:5060;branch=z9hG4bKdhat\r\n\
Max-Forwards: 70\r\n\
To: Bob <sip:bob@biloxi.example.com>\r\n\
From: Alice <sip:alice@atlanta.example.com>;tag=dhat\r\n\
Call-ID: dhat-invite@pc33.atlanta.example.com\r\n\
CSeq: 1 INVITE\r\n\
Contact: <sip:alice@pc33.atlanta.example.com>\r\n\
Content-Length: 0\r\n\r\n";