MCPcopy Create free account
hub / github.com/apache/datafusion / criterion_benchmark

Function criterion_benchmark

datafusion/core/benches/map_query_sql.rs:65–96  ·  view source on GitHub ↗
(c: &mut Criterion)

Source from the content-addressed store, hash-verified

63}
64
65fn criterion_benchmark(c: &mut Criterion) {
66 let ctx = create_context(1).unwrap();
67 let rt = Runtime::new().unwrap();
68 let df = rt.block_on(ctx.lock().table("t")).unwrap();
69
70 let mut rng = rand::rng();
71 let keys = build_keys(&mut rng);
72 let values = build_values(&mut rng);
73 let mut key_buffer = Vec::new();
74 let mut value_buffer = Vec::new();
75
76 for i in 0..1000 {
77 key_buffer.push(Expr::Literal(
78 ScalarValue::Utf8(Some(keys[i].clone())),
79 None,
80 ));
81 value_buffer.push(Expr::Literal(ScalarValue::Int32(Some(values[i])), None));
82 }
83 c.bench_function("map_1000_1", |b| {
84 b.iter(|| {
85 black_box(
86 rt.block_on(
87 df.clone()
88 .select(vec![map(key_buffer.clone(), value_buffer.clone())])
89 .unwrap()
90 .collect(),
91 )
92 .unwrap(),
93 );
94 });
95 });
96}
97
98criterion_group!(benches, criterion_benchmark);
99criterion_main!(benches);

Callers

nothing calls this directly

Calls 11

newFunction · 0.85
build_keysFunction · 0.85
build_valuesFunction · 0.85
collectMethod · 0.80
create_contextFunction · 0.70
LiteralInterface · 0.50
tableMethod · 0.45
pushMethod · 0.45
cloneMethod · 0.45
iterMethod · 0.45
selectMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…