Skip to content

Commit 2d90f97

Browse files
fix(profiling): pass dictionary to interning bench StringTable
Update the interning_strings benchmark to construct a ProfilesDictionary Arc and pass it into StringTable::new so benches compile with the required dictionary-backed constructor. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d3e879d commit 2d90f97

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

libdd-profiling/benches/interning_strings.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
use criterion::*;
55
use libdd_profiling::collections::string_table::wordpress_test_data::WORDPRESS_STRINGS;
6+
use libdd_profiling::profiles::collections::Arc;
7+
use libdd_profiling::profiles::datatypes::ProfilesDictionary;
68

79
/// This version is the one we used before having datadog-alloc.
810
#[allow(unused)]
@@ -49,7 +51,11 @@ use libdd_profiling::collections::string_table::StringTable;
4951
pub fn small_wordpress_profile(c: &mut Criterion) {
5052
c.bench_function("benching string interning on wordpress profile", |b| {
5153
b.iter(|| {
52-
let mut table = StringTable::new();
54+
let dictionary =
55+
ProfilesDictionary::try_new().expect("failed to create ProfilesDictionary");
56+
let dictionary =
57+
Arc::try_new(dictionary).expect("failed to allocate Arc<ProfilesDictionary>");
58+
let mut table = StringTable::new(dictionary);
5359
let n_strings = WORDPRESS_STRINGS.len();
5460
for string in WORDPRESS_STRINGS {
5561
black_box(table.intern(string));

0 commit comments

Comments
 (0)