[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 4d73262 152/271: Speed up local name lookup.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 4d73262 152/271: Speed up local name lookup. |
Date: |
Thu, 05 Feb 2015 18:30:42 +0000 |
branch: master
commit 4d7326203532a0074cf9f81fabb2210ffe72c04a
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Speed up local name lookup.
---
context-coloring.el | 33 ++++++++++++++++++++++-----------
1 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 99c56a7..e3ea326 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -196,7 +196,7 @@ For example: \"context-coloring-level-1-face\"."
;;; Colorization utilities
-(defsubst context-coloring-uncolorize-buffer ()
+(defun context-coloring-uncolorize-buffer ()
"Clears all coloring in the current buffer."
(remove-text-properties (point-min) (point-max) `(face nil rear-nonsticky
nil)))
@@ -228,15 +228,26 @@ For example: \"context-coloring-level-1-face\"."
(setq scope enclosing-scope))
level))
-;; Obtained from js2-refactor.el/js2r-vars.el
-(defun context-coloring-js2-local-name-node-p (node)
+;; Adapted from js2-refactor.el/js2r-vars.el
+(defsubst context-coloring-js2-local-name-node-p (node)
(and (js2-name-node-p node)
- (not (save-excursion ; not key in object literal { key: value }
- (goto-char (+ (js2-node-abs-pos node) (js2-node-len node)))
- (looking-at "[\n\t ]*:")))
- (not (save-excursion ; not property lookup on object
- (goto-char (js2-node-abs-pos node))
- (looking-back "\\.[\n\t ]*")))))
+ (let ((start (js2-node-abs-pos node)))
+ (and
+ ;; (save-excursion ; not key in object literal { key: value }
+ ;; (goto-char (+ (js2-node-abs-pos node) (js2-node-len node)))
+ ;; (looking-at "[\n\t ]*:"))
+ (let ((end (+ start (js2-node-len node))))
+ (not (string-match "[\n\t ]*:" (buffer-substring-no-properties
+ end
+ (+ end 1)))))
+ ;; (save-excursion ; not property lookup on object
+ ;; (goto-char (js2-node-abs-pos node))
+ ;; (looking-back "\\.[\n\t ]*"))
+ (not (string-match "\\.[\n\t ]*" (buffer-substring-no-properties
+ (max 1 (- start 1)) ; 0 throws an
+ ; error. ""
will
+ ; fail the
test.
+ start)))))))
(defun context-coloring-js2-colorize ()
(with-silent-modifications
@@ -288,7 +299,7 @@ level. The vector is flat, with a new token occurring after
every
"Specialized JSON parser for a flat array of numbers."
(vconcat (mapcar 'string-to-number (split-string (substring input 1 -1)
","))))
-(defsubst context-coloring-kill-scopifier ()
+(defun context-coloring-kill-scopifier ()
"Kills the currently-running scopifier process for this
buffer."
(when (not (null context-coloring-scopifier-process))
@@ -433,7 +444,7 @@ colorizing would be redundant."
;; Colorize once initially.
;; (let ((start-time (float-time)))
(context-coloring-colorize)
- ;; (message "Elapsed time: %f" (- (float-time) start-time)))
+ ;; (message "Elapsed time: %f" (- (float-time) start-time)))
;; Only recolor on change.
(add-hook 'after-change-functions 'context-coloring-change-function nil t)
- [elpa] master bdfdbe4 151/271: Improve benchmarks., (continued)
- [elpa] master bdfdbe4 151/271: Improve benchmarks., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d27f2fe 182/271: Fix callback removal., Jackson Ray Hamilton, 2015/02/05
- [elpa] master cb0644a 136/271: Cleanup JavaScript tests., Jackson Ray Hamilton, 2015/02/05
- [elpa] master c1e9226 171/271: Reorganize lib., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 9e14226 135/271: Merge branch 'feature/language-generalization' into develop, Jackson Ray Hamilton, 2015/02/05
- [elpa] master 7473cc9 169/271: Improve documentation and error handling for async tests., Jackson Ray Hamilton, 2015/02/05
- [elpa] master b468d1c 166/271: Improve block scope test. Rename and document block scope variable., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d411168 175/271: Revert to single var., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 4c5f3ab 145/271: Fix first-run bug, passing js2-mode test., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 15bfad7 165/271: Renames., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 4d73262 152/271: Speed up local name lookup.,
Jackson Ray Hamilton <=
- [elpa] master 4fee39d 174/271: Remove .jslintrc files., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 903d938 176/271: Update readme., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d48e8cc 057/271: Add benchmark., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d157167 258/271: Strip headers. Use make dependencies., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 63e2590 207/271: Merge branch 'develop', Jackson Ray Hamilton, 2015/02/05
- [elpa] master d4ddaa6 160/271: Use edge js2-mode., Jackson Ray Hamilton, 2015/02/05
- [elpa] master ef461da 230/271: Stop maintaining benchmarks in readme., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 5e46686 173/271: Remove JS tests and benchmarks. Remove color schemer., Jackson Ray Hamilton, 2015/02/05
- [elpa] master f9c3de8 252/271: Version 3.1.1., Jackson Ray Hamilton, 2015/02/05
- [elpa] master f2b5d79 264/271: Remove unnecessary .elpaignore., Jackson Ray Hamilton, 2015/02/05