←back to thread

89 points Numerlor | 1 comments | | HN request time: 0.202s | source
Show context
wodenokoto ◴[] No.41846571[source]
I feel like there’s a missing discussion as to why they aren’t going with Ipython
replies(7): >>41848474 #>>41851105 #>>41851125 #>>41851190 #>>41851214 #>>41852161 #>>41852289 #
o11c ◴[] No.41852161[source]
The horrible startup time is probably part of it:

  $ time ipython3 -c 'pass'
  real    0m1.083s
  user    0m0.355s
  sys     0m0.093s
replies(1): >>41854237 #
Macha ◴[] No.41854237[source]
Is this worse than the standard python interpreter? Python startup time is a big reason I've moved a bunch of my personal utilities to Rust.
replies(1): >>41854293 #
1. o11c ◴[] No.41854293[source]
CPython startup is pretty fast assuming you aren't importing heavy modules. Of course, any nontrivial program needs to do some imports.

Some examples:

  0.01s cpython - with site disabled
  0.04s pypy - with site disabled
  0.04s cpython - import site and/or built-in modules
  0.08s pypy - import site and/or built-in modules
  0.13s cpython - import requests  
  0.31s pypy - import requests
  0.31s cpython - import IPython
  0.72s pypy - import IPython
  1.1s cpython - run ipython nop
  2.1s pypy - run ipython nop
(the last digit of all of these numbers often varies a little)

Since Python's startup is reasonably fast, it's possible to use it for interactive tools even with heavy imports by spawning a daemon the first time, and just forwarding the requests over a socket. This is mildly annoying but not particularly difficult.