@@ -9,34 +9,45 @@ use crate::{
99 treepp:: * ,
1010} ;
1111
12+ use super :: arithmetics:: u29x9:: u29x9_mul_karazuba;
13+
1214#[ test]
1315#[ ignore = "performance debugging" ]
1416fn debug_mul_performance_comparison ( ) {
15- let naive_script_narrow = U254 :: OP_MUL ( ) ;
16- let windowed_script_narrow = U254Windowed :: OP_MUL ( ) ;
17+ let naive_script_overflowing = U254 :: OP_MUL ( ) ;
18+ let windowed_script_overflowing = U254Windowed :: OP_MUL ( ) ;
1719
18- let naive_script_wide = U254 :: OP_WIDENINGMUL :: < U508 > ( ) ;
19- let windowed_script_wide = U254Windowed :: OP_WIDENINGMUL :: < U508 > ( ) ;
20- let cmpeq_script_wide = U255Cmpeq :: OP_WIDENINGMUL :: < U510 > ( ) ;
20+ let naive_script_widening = U254 :: OP_WIDENINGMUL :: < U508 > ( ) ;
21+ let windowed_script_widening = U254Windowed :: OP_WIDENINGMUL :: < U508 > ( ) ;
22+ let cmpeq_script_widening = U255Cmpeq :: OP_WIDENINGMUL :: < U510 > ( ) ;
23+ let u29x9_karatsuba_script_widening = u29x9_mul_karazuba ( 0 , 1 ) ;
2124
2225 // Create the table
2326 let mut table = Table :: new ( ) ;
2427
2528 // Add the headers
26- table. add_row ( row ! [ "Variant " , "Naive (BitVM) " , "Cmpeq" , "Windowed (Ours) "] ) ;
29+ table. add_row ( row ! [ "Approach " , "Overflowing " , "Widening " ] ) ;
2730
2831 // Add the data
2932 table. add_row ( row ! [
30- "Narrow" ,
31- naive_script_narrow. len( ) ,
33+ "Cmpeq" ,
34+ "-" ,
35+ cmpeq_script_widening. len( ) ,
36+ ] ) ;
37+ table. add_row ( row ! [
38+ "BitVM bigint" ,
39+ naive_script_overflowing. len( ) ,
40+ naive_script_widening. len( ) ,
41+ ] ) ;
42+ table. add_row ( row ! [
43+ "BitVM Karatsuba" ,
3244 "-" ,
33- windowed_script_narrow . len( )
45+ u29x9_karatsuba_script_widening . len( ) ,
3446 ] ) ;
3547 table. add_row ( row ! [
36- "Wide" ,
37- naive_script_wide. len( ) ,
38- cmpeq_script_wide. len( ) ,
39- windowed_script_wide. len( )
48+ "Our w-width method" ,
49+ windowed_script_overflowing. len( ) ,
50+ windowed_script_widening. len( ) ,
4051 ] ) ;
4152
4253 // Print the table
0 commit comments