@@ -559,21 +559,22 @@ def time_add_reduce_arg_parsing(self, arg_pack):
559
559
np .add .reduce (* arg_pack .args , ** arg_pack .kwargs )
560
560
561
561
class BinaryBench (Benchmark ):
562
- def setup (self ):
562
+ params = [np .float32 , np .float64 ]
563
+ param_names = ['dtype' ]
564
+
565
+ def setup (self , dtype ):
563
566
N = 1000000
564
- self .a32 = np .random .rand (N ).astype (np .float32 )
565
- self .b32 = np .random .rand (N ).astype (np .float32 )
566
- self .a64 = np .random .rand (N ).astype (np .float64 )
567
- self .b64 = np .random .rand (N ).astype (np .float64 )
567
+ self .a = np .random .rand (N ).astype (dtype )
568
+ self .b = np .random .rand (N ).astype (dtype )
568
569
569
- def time_pow_32 (self ):
570
- np .power (self .a32 , self .b32 )
570
+ def time_pow (self , dtype ):
571
+ np .power (self .a , self .b )
571
572
572
- def time_pow_64 (self ):
573
- np .power (self .a64 , self . b64 )
573
+ def time_pow_2 (self , dtype ):
574
+ np .power (self .a , 2.0 )
574
575
575
- def time_atan2_32 (self ):
576
- np .arctan2 (self .a32 , self . b32 )
576
+ def time_pow_half (self , dype ):
577
+ np .power (self .a , 0.5 )
577
578
578
- def time_atan2_64 (self ):
579
- np .arctan2 (self .a64 , self .b64 )
579
+ def time_atan2 (self , dtype ):
580
+ np .arctan2 (self .a , self .b )
0 commit comments