@@ -108,6 +108,7 @@ fn run_bench<T: FastFloat, F: Fn(&str) -> T>(
108
108
#[ derive( Debug , Copy , Clone , Eq , PartialEq ) ]
109
109
enum Method {
110
110
FastFloat ,
111
+ FastFloat2 ,
111
112
Lexical ,
112
113
FromStr ,
113
114
}
@@ -123,23 +124,27 @@ fn type_str(float32: bool) -> &'static str {
123
124
impl Method {
124
125
pub fn name ( & self ) -> & ' static str {
125
126
match self {
127
+ Self :: FastFloat2 => "fast-float2" ,
126
128
Self :: FastFloat => "fast-float" ,
127
129
Self :: Lexical => "lexical" ,
128
130
Self :: FromStr => "from_str" ,
129
131
}
130
132
}
131
133
132
- fn run_as < T : FastFloat + FromLexical + FromStr > (
134
+ fn run_as < T : FastFloat + fast_float :: FastFloat + FromLexical + FromStr > (
133
135
& self ,
134
136
input : & Input ,
135
137
repeat : usize ,
136
138
name : & str ,
137
139
) -> BenchResult {
138
140
let data = & input. data ;
139
141
let times = match self {
140
- Self :: FastFloat => run_bench ( data, repeat, |s : & str | {
142
+ Self :: FastFloat2 => run_bench ( data, repeat, |s : & str | {
141
143
fast_float2:: parse_partial :: < T , _ > ( s) . unwrap_or_default ( ) . 0
142
144
} ) ,
145
+ Self :: FastFloat => run_bench ( data, repeat, |s : & str | {
146
+ fast_float:: parse_partial :: < T , _ > ( s) . unwrap_or_default ( ) . 0
147
+ } ) ,
143
148
Self :: Lexical => run_bench ( data, repeat, |s : & str | {
144
149
lexical_core:: parse_partial :: < T > ( s. as_bytes ( ) )
145
150
. unwrap_or_default ( )
@@ -165,7 +170,7 @@ impl Method {
165
170
}
166
171
167
172
pub fn all ( ) -> & ' static [ Self ] {
168
- & [ Method :: FastFloat , Method :: Lexical , Method :: FromStr ]
173
+ & [ Method :: FastFloat2 , Method :: FastFloat , Method :: Lexical , Method :: FromStr ]
169
174
}
170
175
}
171
176
@@ -279,7 +284,7 @@ fn main() {
279
284
let methods = if !opt. only_fast_float && !matches ! ( & opt. command, & Cmd :: All { ..} ) {
280
285
Method :: all ( ) . into ( )
281
286
} else {
282
- vec ! [ Method :: FastFloat ]
287
+ vec ! [ Method :: FastFloat2 ]
283
288
} ;
284
289
285
290
let inputs = match opt. command {
0 commit comments