1
1
use criterion:: { criterion_group, criterion_main} ;
2
+ use ion_rs:: MacroTable ;
2
3
3
4
#[ cfg( not( feature = "experimental" ) ) ]
4
5
mod benchmark {
@@ -44,12 +45,12 @@ fn maximally_compact_1_1_data(num_values: usize) -> TestData_1_1 {
44
45
)
45
46
"# . to_owned ( ) ;
46
47
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) ;
48
49
49
50
let mut binary_1_1_data = vec ! [ 0xE0u8 , 0x01 , 0x01 , 0xEA ] ; // IVM
50
51
#[ rustfmt:: skip]
51
52
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
53
54
0b10 , // [NOTE: `0b`] `parameters*` arg is an arg group
54
55
0x66 , // 6-byte integer (`timestamp` param)
55
56
0x75 , 0x5D , 0x63 , 0xEE , 0x84 , 0x01 ,
@@ -107,11 +108,11 @@ fn moderately_compact_1_1_data(num_values: usize) -> TestData_1_1 {
107
108
)
108
109
"# ;
109
110
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) ;
111
112
let mut binary_1_1_data = vec ! [ 0xE0u8 , 0x01 , 0x01 , 0xEA ] ; // IVM
112
113
#[ rustfmt:: skip]
113
114
let mut binary_1_1_data_body: Vec < u8 > = vec ! [
114
- 0x03 ,
115
+ MacroTable :: FIRST_USER_MACRO_ID as u8 , // Macro ID
115
116
0b10 , // [NOTE: `0b` prefix] `parameters*` arg is an arg group
116
117
0x66 , // 6-byte integer (`timestamp` param)
117
118
0x75 , 0x5D , 0x63 , 0xEE , 0x84 , 0x01 ,
@@ -127,7 +128,7 @@ fn moderately_compact_1_1_data(num_values: usize) -> TestData_1_1 {
127
128
0x65 , 0x78 , 0x61 , 0x6D , 0x70 , 0x6C , 0x65 , 0x2D , 0x63 , 0x6C , 0x69 , 0x65 , 0x6E , 0x74 , 0x2D , 0x31 ,
128
129
0xF9 , // long-form string (`host_id` param)
129
130
0x2B , // FlexUInt byte length 21
130
- // "aws-us-east-5f-abc-123 "
131
+ // "aws-us-east-5f-abc123 "
131
132
0x61 , 0x77 , 0x73 , 0x2D , 0x75 , 0x73 ,
132
133
0x2D , 0x65 , 0x61 , 0x73 , 0x74 , 0x2D ,
133
134
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_
178
179
)
179
180
"# ;
180
181
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) ;
182
183
let mut binary_1_1_data = vec ! [ 0xE0u8 , 0x01 , 0x01 , 0xEA ] ; // IVM
183
184
#[ rustfmt:: skip]
184
185
let mut binary_1_1_data_body: Vec < u8 > = vec ! [
185
186
0xF5 , // LP invocation
186
- 0x07 , // Macro ID 3
187
+ ( ( MacroTable :: FIRST_USER_MACRO_ID * 2 ) + 1 ) as u8 , // Macro ID
187
188
0xDF , // Length prefix: FlexUInt 111
188
189
0b10 , // [NOTE: `0b` prefix] `parameters*` arg is an arg group
189
190
0x66 , // 6-byte integer (`timestamp` param)
@@ -200,7 +201,7 @@ fn length_prefixed_moderately_compact_1_1_data(num_values: usize) -> TestData_1_
200
201
0x65 , 0x78 , 0x61 , 0x6D , 0x70 , 0x6C , 0x65 , 0x2D , 0x63 , 0x6C , 0x69 , 0x65 , 0x6E , 0x74 , 0x2D , 0x31 ,
201
202
0xF9 , // long-form string (`host_id` param)
202
203
0x2B , // FlexUInt byte length 21
203
- // "aws-us-east-5f-abc-123 "
204
+ // "aws-us-east-5f-abc123 "
204
205
0x61 , 0x77 , 0x73 , 0x2D , 0x75 , 0x73 ,
205
206
0x2D , 0x65 , 0x61 , 0x73 , 0x74 , 0x2D ,
206
207
0x35 , 0x66 , 0x2D , 0x61 , 0x62 , 0x63 , 0x31 , 0x32 , 0x33 ,
@@ -302,7 +303,7 @@ mod benchmark {
302
303
'loggerName': "com.example.organization.product.component.ClassName",
303
304
'logLevel': INFO,
304
305
'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",],
306
307
}"# . repeat ( num_values) ;
307
308
let text_1_0_data = rewrite_as ( & pretty_data_1_0, v1_0:: Text ) . unwrap ( ) ;
308
309
let binary_1_0_data = rewrite_as ( & pretty_data_1_0, v1_0:: Binary ) . unwrap ( ) ;
0 commit comments