File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
library/coretests/benches Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -342,3 +342,27 @@ fn write_i128_hex(bh: &mut Bencher) {
342
342
black_box ( & mut buf) . clear ( ) ;
343
343
} ) ;
344
344
}
345
+
346
+ #[ bench]
347
+ fn write_i64_exp ( bh : & mut Bencher ) {
348
+ let mut buf = String :: with_capacity ( 1024 ) ;
349
+ bh. iter ( || {
350
+ write ! ( black_box( & mut buf) , "{:e}" , black_box( 0_i64 ) ) . unwrap ( ) ;
351
+ write ! ( black_box( & mut buf) , "{:e}" , black_box( 100_i64 ) ) . unwrap ( ) ;
352
+ write ! ( black_box( & mut buf) , "{:e}" , black_box( -100_i64 ) ) . unwrap ( ) ;
353
+ write ! ( black_box( & mut buf) , "{:e}" , black_box( 1_i64 << 32 ) ) . unwrap ( ) ;
354
+ black_box ( & mut buf) . clear ( ) ;
355
+ } ) ;
356
+ }
357
+
358
+ #[ bench]
359
+ fn write_i128_exp ( bh : & mut Bencher ) {
360
+ let mut buf = String :: with_capacity ( 1024 ) ;
361
+ bh. iter ( || {
362
+ write ! ( black_box( & mut buf) , "{:e}" , black_box( 0_i128 ) ) . unwrap ( ) ;
363
+ write ! ( black_box( & mut buf) , "{:e}" , black_box( 100_i128 ) ) . unwrap ( ) ;
364
+ write ! ( black_box( & mut buf) , "{:e}" , black_box( -100_i128 ) ) . unwrap ( ) ;
365
+ write ! ( black_box( & mut buf) , "{:e}" , black_box( 1_i128 << 64 ) ) . unwrap ( ) ;
366
+ black_box ( & mut buf) . clear ( ) ;
367
+ } ) ;
368
+ }
You can’t perform that action at this time.
0 commit comments