use criterion::{black_box, criterion_group, criterion_main, Criterion}; use cwmp::parse; fn criterion_benchmark(c: &mut Criterion) { c.bench_function("parse add_object", |b| b.iter(|| parse(black_box(String::from(r#" 100 1 The Company AA1234 IAD_001 S99998888 2 PERIODIC 1 2015-01-19T23:08:24+00:00 0 InternetGatewayDevice.DeviceSummary InternetGatewayDevice:1.4[](Baseline:1, EthernetLAN:1, WiFiLAN:1, EthernetWAN:1, ADSLWAN:1, IPPing:1, DSLDiagnostics:1, Time:1), VoiceService:1.0[1](Endpoint:1, SIPEndpoint:1) InternetGatewayDevice.DeviceInfo.SpecVersion 1.0 InternetGatewayDevice.DeviceInfo.HardwareVersion HW1.0 InternetGatewayDevice.DeviceInfo.SoftwareVersion V1.00(beta) InternetGatewayDevice.DeviceInfo.ProvisioningCode InternetGatewayDevice.ManagementServer.ConnectionRequestURL http://2.2.2.2:7676/CWMP/ConnectionRequest InternetGatewayDevice.ManagementServer.ParameterKey InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress 2.2.2.2 "#))))); } criterion_group!(benches, criterion_benchmark); criterion_main!(benches);