Skip to content

Commit c78292e

Browse files
authored
Updates read_many_structs benchmark (#837)
* Update read benchmark macro IDs, text values
1 parent c17b5c8 commit c78292e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

benches/read_many_structs.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use criterion::{criterion_group, criterion_main};
2+
use ion_rs::MacroTable;
23

34
#[cfg(not(feature = "experimental"))]
45
mod benchmark {
@@ -44,12 +45,12 @@ fn maximally_compact_1_1_data(num_values: usize) -> TestData_1_1 {
4445
)
4546
"#.to_owned();
4647

47-
let text_1_1_data = r#"(:event 1670446800245 418 "6" "1" "abc-123" (: "region 4" "2022-12-07T20:59:59.744000Z"))"#.repeat(num_values);
48+
let text_1_1_data = r#"(:event 1670446800245 418 "6" "1" "abc123" (: "region 4" "2022-12-07T20:59:59.744000Z"))"#.repeat(num_values);
4849

4950
let mut binary_1_1_data = vec![0xE0u8, 0x01, 0x01, 0xEA]; // IVM
5051
#[rustfmt::skip]
5152
let mut binary_1_1_data_body: Vec<u8> = vec![
52-
0x03, // Macro ID 3
53+
MacroTable::FIRST_USER_MACRO_ID as u8, // Macro ID
5354
0b10, // [NOTE: `0b`] `parameters*` arg is an arg group
5455
0x66, // 6-byte integer (`timestamp` param)
5556
0x75, 0x5D, 0x63, 0xEE, 0x84, 0x01,
@@ -107,11 +108,11 @@ fn moderately_compact_1_1_data(num_values: usize) -> TestData_1_1 {
107108
)
108109
"#;
109110

110-
let text_1_1_data = r#"(:event 1670446800245 418 "scheduler-thread-6" "example-client-1" "aws-us-east-5f-abc-123" (: "region 4" "2022-12-07T20:59:59.744000Z"))"#.repeat(num_values);
111+
let text_1_1_data = r#"(:event 1670446800245 418 "scheduler-thread-6" "example-client-1" "aws-us-east-5f-abc123" (: "region 4" "2022-12-07T20:59:59.744000Z"))"#.repeat(num_values);
111112
let mut binary_1_1_data = vec![0xE0u8, 0x01, 0x01, 0xEA]; // IVM
112113
#[rustfmt::skip]
113114
let mut binary_1_1_data_body: Vec<u8> = vec![
114-
0x03,
115+
MacroTable::FIRST_USER_MACRO_ID as u8, // Macro ID
115116
0b10, // [NOTE: `0b` prefix] `parameters*` arg is an arg group
116117
0x66, // 6-byte integer (`timestamp` param)
117118
0x75, 0x5D, 0x63, 0xEE, 0x84, 0x01,
@@ -127,7 +128,7 @@ fn moderately_compact_1_1_data(num_values: usize) -> TestData_1_1 {
127128
0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2D, 0x63, 0x6C, 0x69, 0x65, 0x6E, 0x74, 0x2D, 0x31,
128129
0xF9, // long-form string (`host_id` param)
129130
0x2B, // FlexUInt byte length 21
130-
// "aws-us-east-5f-abc-123"
131+
// "aws-us-east-5f-abc123"
131132
0x61, 0x77, 0x73, 0x2D, 0x75, 0x73,
132133
0x2D, 0x65, 0x61, 0x73, 0x74, 0x2D,
133134
0x35, 0x66, 0x2D, 0x61, 0x62, 0x63, 0x31, 0x32, 0x33,
@@ -178,12 +179,12 @@ fn length_prefixed_moderately_compact_1_1_data(num_values: usize) -> TestData_1_
178179
)
179180
"#;
180181

181-
let text_1_1_data = r#"(:event 1670446800245 418 "scheduler-thread-6" "example-client-1" "aws-us-east-5f-abc-123" (: "region 4" "2022-12-07T20:59:59.744000Z"))"#.repeat(num_values);
182+
let text_1_1_data = r#"(:event 1670446800245 418 "scheduler-thread-6" "example-client-1" "aws-us-east-5f-abc123" (: "region 4" "2022-12-07T20:59:59.744000Z"))"#.repeat(num_values);
182183
let mut binary_1_1_data = vec![0xE0u8, 0x01, 0x01, 0xEA]; // IVM
183184
#[rustfmt::skip]
184185
let mut binary_1_1_data_body: Vec<u8> = vec![
185186
0xF5, // LP invocation
186-
0x07, // Macro ID 3
187+
((MacroTable::FIRST_USER_MACRO_ID * 2) + 1) as u8, // Macro ID
187188
0xDF, // Length prefix: FlexUInt 111
188189
0b10, // [NOTE: `0b` prefix] `parameters*` arg is an arg group
189190
0x66, // 6-byte integer (`timestamp` param)
@@ -200,7 +201,7 @@ fn length_prefixed_moderately_compact_1_1_data(num_values: usize) -> TestData_1_
200201
0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2D, 0x63, 0x6C, 0x69, 0x65, 0x6E, 0x74, 0x2D, 0x31,
201202
0xF9, // long-form string (`host_id` param)
202203
0x2B, // FlexUInt byte length 21
203-
// "aws-us-east-5f-abc-123"
204+
// "aws-us-east-5f-abc123"
204205
0x61, 0x77, 0x73, 0x2D, 0x75, 0x73,
205206
0x2D, 0x65, 0x61, 0x73, 0x74, 0x2D,
206207
0x35, 0x66, 0x2D, 0x61, 0x62, 0x63, 0x31, 0x32, 0x33,
@@ -302,7 +303,7 @@ mod benchmark {
302303
'loggerName': "com.example.organization.product.component.ClassName",
303304
'logLevel': INFO,
304305
'format': "Request status: {} Client ID: {} Client Host: {} Client Region: {} Timestamp: {}",
305-
'parameters': ["SUCCESS","example-client-1","aws-us-east-5f-abc-123","region 4","2022-12-07T20:59:59.744000Z",],
306+
'parameters': ["SUCCESS","example-client-1","aws-us-east-5f-abc123","region 4","2022-12-07T20:59:59.744000Z",],
306307
}"#.repeat(num_values);
307308
let text_1_0_data = rewrite_as(&pretty_data_1_0, v1_0::Text).unwrap();
308309
let binary_1_0_data = rewrite_as(&pretty_data_1_0, v1_0::Binary).unwrap();

0 commit comments

Comments
 (0)