File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,16 @@ macro_rules! impl_te_group_ops {
172
172
* self = self . add_impl( self )
173
173
}
174
174
}
175
+
176
+ // Note: It was found that implementing `is_identity` in group.rs as a default
177
+ // implementation increases the cycle count by 50% on the ecrecover benchmark. For
178
+ // this reason, we implement it here instead. We hypothesize that this is due to
179
+ // compiler optimizations that are not possible when the `is_identity` function is
180
+ // defined in a different source file.
181
+ #[ inline( always) ]
182
+ fn is_identity( & self ) -> bool {
183
+ self == & <Self as Group >:: IDENTITY
184
+ }
175
185
}
176
186
177
187
impl core:: ops:: Add <& $struct_name> for $struct_name {
Original file line number Diff line number Diff line change @@ -451,11 +451,11 @@ macro_rules! impl_sw_group_ops {
451
451
self . double_assign_impl:: <true >( ) ;
452
452
}
453
453
454
- // This implementation is the same as the default implementation in the `Group` trait,
455
- // but it was found that overriding the default implementation reduced the cycle count
456
- // by 50% on the ecrecover benchmark.
457
- // We hypothesize that this is due to compiler optimizations that are not possible when
458
- // the `is_identity` function is defined in a different source file.
454
+ // Note: It was found that implementing `is_identity` in group.rs as a default
455
+ // implementation increases the cycle count by 50% on the ecrecover benchmark. For
456
+ // this reason, we implement it here instead. We hypothesize that this is due to
457
+ // compiler optimizations that are not possible when the `is_identity` function is
458
+ // defined in a different source file.
459
459
#[ inline( always) ]
460
460
fn is_identity( & self ) -> bool {
461
461
self == & <Self as Group >:: IDENTITY
You can’t perform that action at this time.
0 commit comments