MCPcopy Create free account
hub / github.com/cosdata/cosdata / benchmark_hashset_lookup

Function benchmark_hashset_lookup

org/src/performant_fixed_set.rs:85–101  ·  view source on GitHub ↗
(total_elements: usize)

Source from the content-addressed store, hash-verified

83}
84
85fn benchmark_hashset_lookup(total_elements: usize) -> (std::time::Duration, usize) {
86 let mut hash_set = HashSet::new();
87
88 // Populate the set
89 for i in 0..total_elements {
90 hash_set.insert(i);
91 }
92
93 // Benchmark lookups
94 let start = Instant::now();
95 let lookups = (0..total_elements)
96 .filter(|&i| hash_set.contains(&i))
97 .count();
98 let duration = start.elapsed();
99
100 (duration, lookups)
101}
102
103fn main() {
104 let total_elements = 5000;

Callers 1

mainFunction · 0.85

Calls 2

containsMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected