| 474 | |
| 475 | |
| 476 | class ArgParsingReduce(Benchmark): |
| 477 | # In order to benchmark the speed of argument parsing, all but the |
| 478 | # out arguments are chosen such that they have minimal effect on the |
| 479 | # calculation. |
| 480 | a = np.arange(2.) |
| 481 | out = np.array(0.) |
| 482 | param_names = ['arg_kwarg'] |
| 483 | params = [[ |
| 484 | ArgPack(a,), |
| 485 | ArgPack(a, 0), |
| 486 | ArgPack(a, axis=0), |
| 487 | ArgPack(a, 0, None), |
| 488 | ArgPack(a, axis=0, dtype=None), |
| 489 | ArgPack(a, 0, None, out), |
| 490 | ArgPack(a, axis=0, dtype=None, out=out), |
| 491 | ArgPack(a, out=out) |
| 492 | ]] |
| 493 | |
| 494 | def time_add_reduce_arg_parsing(self, arg_pack): |
| 495 | np.add.reduce(*arg_pack.args, **arg_pack.kwargs) |
| 496 | |
| 497 | class BinaryBench(Benchmark): |
| 498 | def setup(self): |