| 449 | |
| 450 | |
| 451 | class ArgParsing(Benchmark): |
| 452 | # In order to benchmark the speed of argument parsing, all but the |
| 453 | # out arguments are chosen such that they have no effect on the |
| 454 | # calculation. In particular, subok=True and where=True are |
| 455 | # defaults, and the dtype is the correct one (the latter will |
| 456 | # still have some effect on the search for the correct inner loop). |
| 457 | x = np.array(1.) |
| 458 | y = np.array(2.) |
| 459 | out = np.array(3.) |
| 460 | param_names = ['arg_kwarg'] |
| 461 | params = [[ |
| 462 | ArgPack(x, y), |
| 463 | ArgPack(x, y, out), |
| 464 | ArgPack(x, y, out=out), |
| 465 | ArgPack(x, y, out=(out,)), |
| 466 | ArgPack(x, y, out=out, subok=True, where=True), |
| 467 | ArgPack(x, y, subok=True), |
| 468 | ArgPack(x, y, subok=True, where=True), |
| 469 | ArgPack(x, y, out, subok=True, where=True) |
| 470 | ]] |
| 471 | |
| 472 | def time_add_arg_parsing(self, arg_pack): |
| 473 | np.add(*arg_pack.args, **arg_pack.kwargs) |
| 474 | |
| 475 | |
| 476 | class ArgParsingReduce(Benchmark): |