[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a556195 26/47: Tweak iteration values, add logging.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master a556195 26/47: Tweak iteration values, add logging. |
Date: |
Mon, 18 May 2015 09:51:55 +0000 |
branch: master
commit a5561959ebcdca49de518b7e8a40785bde5a52bf
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Tweak iteration values, add logging.
---
context-coloring.el | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 22097a5..a513947 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -406,11 +406,17 @@ generated by `js2-mode'."
(defvar context-coloring-parse-interruptable-p t
"Set this to nil to force parse to continue until finished.")
-(defvar context-coloring-tokens-per-pause 25
- "Pause after this many statements to check for user input.
+(defvar context-coloring-emacs-lisp-iterations-per-pause 1000
+ "Pause after this many iterations to check for user input.
If user input is pending, stop the parse. This makes for a
-smoother user experience for large files. This appears to be
-more or less how Eclipse, IntelliJ and other editors work.")
+smoother user experience for large files.
+
+As of this writing, emacs lisp colorization seems to run at about
+60,000 iterations per second. A default value of 1000 should
+provide visually \"instant\" updates at ~60 frames per second.")
+
+(defvar context-coloring-verbose-parse t
+ "Log useful information pertaining to a parse.")
(defun context-coloring-emacs-lisp-colorize ()
"Color the current buffer by parsing emacs lisp sexps."
@@ -418,8 +424,9 @@ more or less how Eclipse, IntelliJ and other editors work.")
(save-excursion
;; TODO: Can probably make this lazy to the nearest defun.
(goto-char (point-min))
- (let* ((inhibit-point-motion-hooks t)
- (token-count 0)
+ (let* ((start-time (float-time))
+ (inhibit-point-motion-hooks t)
+ (iteration-count 0)
(end (point-max))
(last-ppss-pos (point))
(ppss (syntax-ppss))
@@ -460,8 +467,8 @@ more or less how Eclipse, IntelliJ and other editors work.")
(while (> end (progn (skip-syntax-forward "^()w_'" end)
(point)))
(and context-coloring-parse-interruptable-p
- (zerop (% (setq token-count (1+ token-count))
- context-coloring-tokens-per-pause))
+ (zerop (% (setq iteration-count (1+ iteration-count))
+ context-coloring-emacs-lisp-iterations-per-pause))
(input-pending-p)
(throw 'interrupted t))
(setq token-pos (point))
@@ -693,7 +700,10 @@ more or less how Eclipse, IntelliJ and other editors
work.")
(context-coloring-scope-add-variable (car scope-stack) (car
popped-vars))
(setq popped-vars (cdr popped-vars))))
- ))))
+ ))
+ (when context-coloring-verbose-parse
+ (message "Elapsed: %s; iterations: %s"
+ (- (float-time) start-time) iteration-count))))
(context-coloring-maybe-colorize-comments-and-strings)))
- [elpa] master 926d74a 17/47: Include binding order in let* test., (continued)
- [elpa] master 926d74a 17/47: Include binding order in let* test., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 29328af 18/47: Add let test., Jackson Ray Hamilton, 2015/05/18
- [elpa] master ea3ff31 16/47: Pass let* test., Jackson Ray Hamilton, 2015/05/18
- [elpa] master b28e896 19/47: Add complex nesting to let test., Jackson Ray Hamilton, 2015/05/18
- [elpa] master bd9c147 20/47: Ignore the dot., Jackson Ray Hamilton, 2015/05/18
- [elpa] master d7b2c92 21/47: Remove unused functions., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 0836b9f 22/47: Add change hooks for elisp., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 08bf3e4 23/47: Ignore question marks., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 09ec36e 24/47: Add interruption mechanism., Jackson Ray Hamilton, 2015/05/18
- [elpa] master dc2f9a6 25/47: Refactor maybe-colorize-comments-and-strings., Jackson Ray Hamilton, 2015/05/18
- [elpa] master a556195 26/47: Tweak iteration values, add logging.,
Jackson Ray Hamilton <=
- [elpa] master 3fc5b20 27/47: Make dispatches fully redefinable., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 89f20e4 28/47: Improve interruptability of syntactic coloring., Jackson Ray Hamilton, 2015/05/18
- [elpa] master d24de46 31/47: Add TODO., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 07c5852 30/47: Add idle change teardown function., Jackson Ray Hamilton, 2015/05/18
- [elpa] master ef544ef 29/47: Fontify keywords., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 5c5b429 32/47: Fix font-lock error., Jackson Ray Hamilton, 2015/05/18
- [elpa] master c0a6689 33/47: Only set defaults when the mode is enabled., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 59a6c8e 34/47: Fix timer disposal and timer buffer detection., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 88a921f 35/47: Improve defun regexp., Jackson Ray Hamilton, 2015/05/18
- [elpa] master 438cb33 36/47: Fix incorrect last fontified position., Jackson Ray Hamilton, 2015/05/18