mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-05 17:11:41 -05:00
ein-utils: Make gc-cons-threshold adjustment optional.
EIN doesn't seem to always return gc-cons-threshold to its original value; this makes for performance problems, particularly on Windows builds, so this behavior is now optional and user-configurable.
This commit is contained in:
parent
793d5fa192
commit
4c33a8b057
1 changed files with 9 additions and 2 deletions
|
@ -677,14 +677,21 @@ Use `ein:log' for debugging and logging."
|
|||
`[,name ,callback :help ,(ein:get-docstring callback) ,@args]))
|
||||
list-name-callback))
|
||||
|
||||
(defcustom ein:enable-gc-adjust t
|
||||
"When t, EIN will set the `gc-cons-threshold' to an arbitrarily large value when opening notebookes. In some cases this adjustment will improve emacs performance, particularly when loading large notebooks."
|
||||
:type 'boolean
|
||||
:group 'ein)
|
||||
|
||||
(lexical-let ((current-gc-cons-threshold gc-cons-threshold))
|
||||
(defun ein:gc-prepare-operation ()
|
||||
(ein:log 'debug "[GC-PREPARE-OPERATION] Setting cons threshold to %s." (* current-gc-cons-threshold 10000) )
|
||||
(setq gc-cons-threshold (* current-gc-cons-threshold 10000)))
|
||||
(when ein:enable-gc-adjust
|
||||
(setq gc-cons-threshold (* current-gc-cons-threshold 10000))))
|
||||
|
||||
(defun ein:gc-complete-operation ()
|
||||
(ein:log 'debug "[GC-COMPLETE-OPERATION] Reverting cons threshold to %s." current-gc-cons-threshold)
|
||||
(setq gc-cons-threshold current-gc-cons-threshold)))
|
||||
(when ein:enable-gc-adjust
|
||||
(setq gc-cons-threshold current-gc-cons-threshold))))
|
||||
|
||||
|
||||
;;; Git utilities
|
||||
|
|
Loading…
Add table
Reference in a new issue