Simple way to measure cell execution time in ipython notebook

后端 未结 12 1410
春和景丽
春和景丽 2020-11-29 15:17

I would like to get the time spent on the cell execution in addition to the original output from cell.

To this end, I tried %%timeit -r1 -n1 but it does

12条回答
  •  自闭症患者
    2020-11-29 16:00

    When in trouble what means what:

    ?%timeit or ??timeit

    To get the details:

    Usage, in line mode:
      %timeit [-n -r [-t|-c] -q -p

    -o] statement or in cell mode: %%timeit [-n -r [-t|-c] -q -p

    -o] setup_code code code... Time execution of a Python statement or expression using the timeit module. This function can be used both as a line and cell magic: - In line mode you can time a single-line statement (though multiple ones can be chained with using semicolons). - In cell mode, the statement in the first line is used as setup code (executed but not timed) and the body of the cell is timed. The cell body has access to any variables created in the setup code.

提交回复
热议问题