@@ -12,7 +12,6 @@ use dashu_int::{
1212 UBig ,
1313} ;
1414use rand_v08:: prelude:: * ;
15- use std:: fmt:: Write ;
1615use std:: ops:: * ;
1716
1817const SEED : u64 = 1 ;
@@ -54,82 +53,6 @@ add_binop_benchmark!(ubig_div, div, 6);
5453add_binop_benchmark ! ( ubig_gcd, gcd, 6 ) ;
5554add_binop_benchmark ! ( ubig_gcd_ext, gcd_ext, 5 ) ;
5655
57- fn ubig_to_hex ( criterion : & mut Criterion ) {
58- let mut rng = StdRng :: seed_from_u64 ( SEED ) ;
59- let mut group = criterion. benchmark_group ( "ubig_to_hex" ) ;
60- group. plot_config ( PlotConfiguration :: default ( ) . summary_scale ( AxisScale :: Logarithmic ) ) ;
61-
62- for log_bits in 1 ..=6 {
63- let bits = 10usize . pow ( log_bits) ;
64- let a = random_ubig ( bits, & mut rng) ;
65- let mut out = String :: with_capacity ( bits / 4 + 1 ) ;
66- group. bench_with_input ( BenchmarkId :: from_parameter ( bits) , & a, |bencher, ta| {
67- bencher. iter ( || {
68- out. clear ( ) ;
69- write ! ( & mut out, "{:x}" , & ta) . unwrap ( ) ;
70- out. len ( )
71- } )
72- } ) ;
73- }
74-
75- group. finish ( ) ;
76- }
77-
78- fn ubig_to_dec ( criterion : & mut Criterion ) {
79- let mut rng = StdRng :: seed_from_u64 ( SEED ) ;
80- let mut group = criterion. benchmark_group ( "ubig_to_dec" ) ;
81- group. plot_config ( PlotConfiguration :: default ( ) . summary_scale ( AxisScale :: Logarithmic ) ) ;
82-
83- for log_bits in 1 ..=6 {
84- let bits = 10usize . pow ( log_bits) ;
85- let a = random_ubig ( bits, & mut rng) ;
86- let mut out = String :: with_capacity ( bits / 3 + 1 ) ;
87- group. bench_with_input ( BenchmarkId :: from_parameter ( bits) , & a, |bencher, ta| {
88- bencher. iter ( || {
89- out. clear ( ) ;
90- write ! ( & mut out, "{}" , & ta) . unwrap ( ) ;
91- out. len ( )
92- } )
93- } ) ;
94- }
95-
96- group. finish ( ) ;
97- }
98-
99- fn ubig_from_hex ( criterion : & mut Criterion ) {
100- let mut rng = StdRng :: seed_from_u64 ( SEED ) ;
101- let mut group = criterion. benchmark_group ( "ubig_from_hex" ) ;
102- group. plot_config ( PlotConfiguration :: default ( ) . summary_scale ( AxisScale :: Logarithmic ) ) ;
103-
104- for log_bits in 1 ..=6 {
105- let bits = 10usize . pow ( log_bits) ;
106- let a = random_ubig ( bits, & mut rng) ;
107- let s = a. in_radix ( 16 ) . to_string ( ) ;
108- group. bench_with_input ( BenchmarkId :: from_parameter ( bits) , & s, |bencher, ts| {
109- bencher. iter ( || UBig :: from_str_radix ( ts, 16 ) )
110- } ) ;
111- }
112-
113- group. finish ( ) ;
114- }
115-
116- fn ubig_from_dec ( criterion : & mut Criterion ) {
117- let mut rng = StdRng :: seed_from_u64 ( SEED ) ;
118- let mut group = criterion. benchmark_group ( "ubig_from_dec" ) ;
119- group. plot_config ( PlotConfiguration :: default ( ) . summary_scale ( AxisScale :: Logarithmic ) ) ;
120-
121- for log_bits in 1 ..=6 {
122- let bits = 10usize . pow ( log_bits) ;
123- let a = random_ubig ( bits, & mut rng) ;
124- let s = a. in_radix ( 10 ) . to_string ( ) ;
125- group. bench_with_input ( BenchmarkId :: from_parameter ( bits) , & s, |bencher, ts| {
126- bencher. iter ( || UBig :: from_str_radix ( ts, 10 ) )
127- } ) ;
128- }
129-
130- group. finish ( ) ;
131- }
132-
13356fn ubig_pow ( criterion : & mut Criterion ) {
13457 let mut group = criterion. benchmark_group ( "ubig_pow" ) ;
13558 group. plot_config ( PlotConfiguration :: default ( ) . summary_scale ( AxisScale :: Logarithmic ) ) ;
@@ -225,10 +148,6 @@ criterion_group!(
225148 ubig_div,
226149 ubig_gcd,
227150 ubig_gcd_ext,
228- ubig_to_hex,
229- ubig_to_dec,
230- ubig_from_hex,
231- ubig_from_dec,
232151 ubig_pow,
233152 ubig_modulo_mul,
234153 ubig_modulo_pow,
0 commit comments