tkf / emacs-ipython-notebook

IPython notebook client in Emacs
tkf.github.com/emacs-ipython-notebook/
GNU General Public License v3.0
548 stars 51 forks source link

ein notebook is slow to open (frequent timeouts) and save #111

Open ryanolf opened 11 years ago

ryanolf commented 11 years ago

I have a notebook that has become somewhat large (but not absurdly so, I think), about 8MB, mostly because of a number of inline images in the output. This notebook opens and saves promptly in the web-based ipython notebook client. However, ein frequently times out trying to open this notebook and takes many seconds (~10-20) to save it, locking my emacs during this time.

I can provide the notebook upon request.

System information:

relevant init.el: (setq ein:use-auto-complete nil) (setq ein:notebook-modes '(ein:notebook-mumamo-mode ein:notebook-multilang-mode)) (add-hook 'ein:connect-mode-hook 'ein:jedi-setup)

(when (and (equal emacs-major-version 24) (equal emacs-minor-version 2)) (eval-after-load "mumamo" '(setq mumamo-per-buffer-local-vars (delq 'buffer-file-name mumamo-per-buffer-local-vars)))

ipython --version: 0.13.1 started like: ipython --notebook

("EIN system info" :emacs-version "GNU Emacs 24.3.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2013-03-12 on bob.porkrind.org" :emacs-bzr-version nil :window-system ns :emacs-variant nil :os (:uname "Darwin RandKsMacbookPro 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 " :lsb-release nil) :image-types (png gif tiff jpeg xpm xbm pbm) :image-types-available (png gif tiff jpeg xpm xbm pbm) :request (:backend curl) :ein (:version "0.2.1alpha2.203ff99" :source-dir "/Users/ryan/.emacs.d/el-get/ein/lisp/") :lib ((:name "websocket" :path "~/.emacs.d/el-get/websocket/websocket.elc" :featurep t :version-var websocket-version :version "1.0") (:name "request" :path "~/.emacs.d/el-get/request/request.elc" :featurep t :version-var request-version :version "0.2.0alpha1") (:name "auto-complete" :path "~/.emacs.d/el-get/auto-complete/auto-complete.elc" :featurep t :version-var nil :version nil) (:name "mumamo" :path "~/.emacs.d/el-get/nxhtml/util/mumamo.elc" :featurep nil :version-var nil :version nil) (:name "auto-complete" :path "~/.emacs.d/el-get/auto-complete/auto-complete.elc" :featurep t :version-var nil :version nil) (:name "popup" :path "~/.emacs.d/el-get/popup/popup.elc" :featurep t :version-var nil :version nil) (:name "fuzzy" :path "~/.emacs.d/el-get/fuzzy/fuzzy.elc" :featurep nil :version-var nil :version nil) (:name "pos-tip" :path "~/.emacs.d/el-get/pos-tip/pos-tip.elc" :featurep t :version-var pos-tip-version :version "0.4.5") (:name "python" :path "/Applications/Emacs.app/Contents/Resources/lisp/progmodes/python.elc" :featurep t :version-var nil :version nil) (:name "smartrep" :path "~/.emacs.d/el-get/smartrep/smartrep.elc" :featurep t :version-var nil :version nil)))

tkf commented 11 years ago

As you are using curl backend (it is automatically used if you have curl command), you can remove query timeout by the following setup. This should fix the timeout problem, but it won't increase load/save time.

(setq ein:query-timeout nil
      ein:notebook-querty-timeout-open nil
      ein:notebook-querty-timeout-save nil)

The default timeout was chosen so that I can open notebook as big as 50MB or something in my box, but of course this kind of stuff changes machine to machine. See also http://tkf.github.io/emacs-ipython-notebook/#ein:query-timeout etc.

I think load/save is slow because JSON parser I am using is purely written in lisp, although it may be because of badly written code in EIN. I need to profile that at some point. I've heard someone is trying to add native support of JSON parser in Emacs. It should help EIN a lot, as JSON is everywhere when talking to IPython. Maybe you can help Emacs developers adding the native JSON support by testing the dev version or something.