aha
aha

Reputation: 4624

Does running IPython/Jupyter Notebook affect the speed of the program?

I am developing a program for simulation (kind of like numerical solver). I am developing it in an ipython notebook. I am wondering if the speed of the code running in the notebook is the same as the speed of the code running from terminal ?

Would browser memory or overhead from notebook and stuff like that makes code run slower in notebook compared to native run from the terminal?

Upvotes: 15

Views: 39514

Answers (3)

user31264
user31264

Reputation: 6727

I tested learning the same small neural net (1) under Jupyter and (2) running Python under Anaconda prompt (either with exec(open(foo.py).read()) under python or with python foo.py directly under Anaconda prompt).

It takes 107.4 sec or 108.2 sec under Anaconda prompt, and 105.7 sec under Jupyter.

So no, there is no significant difference, and the minor difference is in favor of Jupyter.

Upvotes: 5

Josh
Josh

Reputation: 1305

I have found that Jupyter is significantly slower than Ipython, whether or not many print statements are used. Nearly all functions suffer decreased performance, but especially if you are analyzing large dataframes or performing complex calculations, I would stick with Ipython.

Upvotes: 10

Matt
Matt

Reputation: 27843

One of the things that might slow things a lot would be if you had a lot of print statements in your simulation.

If you run the kernels server and browser on the same machine, assuming your simulation would have used all the cores of your computer, yes using notebook will slow things down. But no more than browsing facebook or Youtube while the simulation is running. Most of the overhead of using IPython is actually when you press shift-enter. In pure python prompt the REPL might react in 100ms, and in IPython 150 or alike. But if you are concern about performance, the overhead of IPython is not the first thing you should be concern about.

Upvotes: 18

Related Questions