MCPcopy Create free account
hub / github.com/apache/fory / bench_write_f64

Function bench_write_f64

benchmarks/rust/benches/buffer_write_bench.rs:105–124  ·  view source on GitHub ↗
(c: &mut Criterion)

Source from the content-addressed store, hash-verified

103}
104
105fn bench_write_f64(c: &mut Criterion) {
106 let mut group = c.benchmark_group("write_f64");
107 group.throughput(Throughput::Elements(1000));
108
109 let values: Vec<f64> = (0..1000).map(|i| i as f64 * 1.23456).collect();
110
111 group.bench_function("current", |b| {
112 let mut buf = Vec::with_capacity(8000);
113 b.iter(|| {
114 buf.clear();
115 let mut writer = Writer::from_buffer(&mut buf);
116 for &val in &values {
117 writer.write_f64(black_box(val));
118 }
119 black_box(&buf);
120 })
121 });
122
123 group.finish();
124}
125
126fn bench_write_var_i32_small(c: &mut Criterion) {
127 let mut group = c.benchmark_group("write_var_i32_small");

Callers

nothing calls this directly

Calls 4

write_f64Method · 0.80
mapMethod · 0.45
clearMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected