fn build_payload(criterion: &mut Criterion) {
    let mut group = criterion.benchmark_group("build_payload");
    group.sample_size(30);
    group.measurement_time(std::time::Duration::from_secs(10));
    for i in 1..=10 {
        let size = 5000 + 10000 * i;
        run_test(
            "get_ingress_payload",
            |time_source: Arc<FastForwardTimeSource>,
             pool: &mut IngressPoolImpl,
             manager: &mut IngressManager,
             registry| {
                let now = time_source.get_relative_time();
                let then = prepare(time_source.as_ref(), pool, now, size);
                time_source.set_time(then).unwrap();
                let name = format!("get_ingress_payload({})", size);
                let byte_limit = registry
                    .get_subnet_record(subnet_test_id(0), RegistryVersion::new(1))
                    .unwrap()
                    .unwrap()
                    .max_block_payload_size;

                group.bench_function(&name, |bench| {
                    bench.iter(|| {
                        let n = get_ingress_payload(then, pool, manager, NumBytes::new(byte_limit));
                        assert!(n > 800, "Insufficient number of ingress in payload: {}", n);
                        assert!(n < 1020, "Too many ingress in payload: {}", n);
                    })
                });
            },
        );
    }
    group.finish()
}
/// Speed test for building ingress payloads.
Speed test for building ingress payloads.
Speed test for building ingress payloads .
fn build_payload(criterion: &mut Criterion) {
    let mut group = criterion.benchmark_group("build_payload");
    group.sample_size(30);
    group.measurement_time(std::time::Duration::from_secs(10));
    for i in 1..=10 {
        let size = 5000 + 10000 * i;
        run_test(
            "get_ingress_payload",
            |time_source: Arc<FastForwardTimeSource>,
             pool: &mut IngressPoolImpl,
             manager: &mut IngressManager,
             registry| {
                let now = time_source.get_relative_time();
                let then = prepare(time_source.as_ref(), pool, now, size);
                time_source.set_time(then).unwrap();
                let name = format!("get_ingress_payload({})", size);
                let byte_limit = registry
                    .get_subnet_record(subnet_test_id(0), RegistryVersion::new(1))
                    .unwrap()
                    .unwrap()
                    .max_block_payload_size;
                group.bench_function(&name, |bench| {
                    bench.iter(|| {
                        let n = get_ingress_payload(then, pool, manager, NumBytes::new(byte_limit));
                        assert!(n > 800, "Insufficient number of ingress in payload: {}", n);
                        assert!(n < 1020, "Too many ingress in payload: {}", n);
                    })
                });
            },
        );
    }
    group.finish()
}
fn build_payload ( criterion : & mut Criterion ) { let mut group = criterion . benchmark_group ( " " ) ; group . sample_size ( 30 ) ; group . measurement_time ( std :: time :: Duration :: from_secs ( 10 ) ) ; for i in 1 ..= 10 { let size = 5000 + 10000 * i ; run_test ( " " , | time_source : Arc < FastForwardTimeSource > , pool : & mut IngressPoolImpl , manager : & mut IngressManager , registry | { let now = time_source . get_relative_time ( ) ; let then = prepare ( time_source . as_ref ( ) , pool , now , size ) ; time_source . set_time ( then ) . unwrap ( ) ; let name = format ! ( " " size ) ; let byte_limit = registry . get_subnet_record ( subnet_test_id ( 0 ) , RegistryVersion :: new ( 1 ) ) . unwrap ( ) . unwrap ( ) . max_block_payload_size ; group . bench_function ( & name , | bench | { bench . iter ( | | { let n = get_ingress_payload ( then , pool , manager , NumBytes :: new ( byte_limit ) ) ; assert ! ( n 800 " " n ) ; assert ! ( n 1020 " " n ) ; } ) } ) ; } , ) ; } group . finish ( ) }
Speed test for building ingress payloads.
Speed test for building ingress payloads .
criterion
&mut Criterion
criterion
&mut Criterion