emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 708276e 41/47: Compiler micro-optimizations.


From: Jackson Ray Hamilton
Subject: [elpa] master 708276e 41/47: Compiler micro-optimizations.
Date: Mon, 18 May 2015 09:52:06 +0000

branch: master
commit 708276e60cf4fc3a6e76f2568df8093991d865ce
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>

    Compiler micro-optimizations.
---
 context-coloring.el |   50 +++++++++++++++++++++++++-------------------------
 1 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index c7a3f08..46561f8 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -290,22 +290,22 @@ generated by `js2-mode'."
 
 ;;; Emacs Lisp colorization
 
-(defun context-coloring-make-scope (depth level)
+(defsubst context-coloring-make-scope (depth level)
   (list
    :depth depth
    :level level
    :variables (make-hash-table)))
 
-(defun context-coloring-scope-get-level (scope)
+(defsubst context-coloring-scope-get-level (scope)
   (plist-get scope :level))
 
-(defun context-coloring-scope-add-variable (scope variable)
+(defsubst context-coloring-scope-add-variable (scope variable)
   (puthash variable t (plist-get scope :variables)))
 
-(defun context-coloring-scope-get-variable (scope variable)
+(defsubst context-coloring-scope-get-variable (scope variable)
   (gethash variable (plist-get scope :variables)))
 
-(defun context-coloring-get-variable-level (scope-stack variable)
+(defsubst context-coloring-get-variable-level (scope-stack variable)
   (let* (scope
          level)
     (while (and scope-stack (not level))
@@ -318,33 +318,33 @@ generated by `js2-mode'."
     ;; Assume a global variable.
     (or level 0)))
 
-(defun context-coloring-make-backtick (end enabled)
+(defsubst context-coloring-make-backtick (end enabled)
   (list
    :end end
    :enabled enabled))
 
-(defun context-coloring-backtick-get-end (backtick)
+(defsubst context-coloring-backtick-get-end (backtick)
   (plist-get backtick :end))
 
-(defun context-coloring-backtick-get-enabled (backtick)
+(defsubst context-coloring-backtick-get-enabled (backtick)
   (plist-get backtick :enabled))
 
-(defun context-coloring-backtick-enabled-p (backtick-stack)
+(defsubst context-coloring-backtick-enabled-p (backtick-stack)
   (context-coloring-backtick-get-enabled (car backtick-stack)))
 
-(defun context-coloring-make-let-varlist (depth type)
+(defsubst context-coloring-make-let-varlist (depth type)
   (list
    :depth depth
    :type type
    :vars '()))
 
-(defun context-coloring-let-varlist-get-type (let-varlist)
+(defsubst context-coloring-let-varlist-get-type (let-varlist)
   (plist-get let-varlist :type))
 
-(defun context-coloring-let-varlist-add-var (let-varlist var)
+(defsubst context-coloring-let-varlist-add-var (let-varlist var)
   (plist-put let-varlist :vars (cons var (plist-get let-varlist :vars))))
 
-(defun context-coloring-let-varlist-pop-vars (let-varlist)
+(defsubst context-coloring-let-varlist-pop-vars (let-varlist)
   (let ((type (context-coloring-let-varlist-get-type let-varlist))
         (vars (plist-get let-varlist :vars)))
     (cond
@@ -359,41 +359,41 @@ generated by `js2-mode'."
           (list (car vars))
         (plist-put let-varlist :vars (cdr vars)))))))
 
-(defun context-coloring-forward-sws ()
+(defsubst context-coloring-forward-sws ()
   "Move forward through whitespace and comments."
   (while (forward-comment 1)))
 
-(defun context-coloring-forward-sexp-position ()
+(defsubst context-coloring-forward-sexp-position ()
   (scan-sexps (point) 1))
 
-(defun context-coloring-emacs-lisp-identifier-syntax-p (syntax-code)
+(defsubst context-coloring-emacs-lisp-identifier-syntax-p (syntax-code)
   (or (= 2 syntax-code)
       (= 3 syntax-code)))
 
-(defun context-coloring-open-parenthesis-p (syntax-code)
+(defsubst context-coloring-open-parenthesis-p (syntax-code)
   (= 4 syntax-code))
 
-(defun context-coloring-close-parenthesis-p (syntax-code)
+(defsubst context-coloring-close-parenthesis-p (syntax-code)
   (= 5 syntax-code))
 
-(defun context-coloring-expression-prefix-p (syntax-code)
+(defsubst context-coloring-expression-prefix-p (syntax-code)
   (= 6 syntax-code))
 
-(defun context-coloring-at-open-parenthesis-p ()
+(defsubst context-coloring-at-open-parenthesis-p ()
   (= 4 (logand #xFFFF (car (syntax-after (point))))))
 
-(defun context-coloring-ppss-depth (ppss)
+(defsubst context-coloring-ppss-depth (ppss)
   ;; Same as (nth 0 ppss).
   (car ppss))
 
-(defun context-coloring-stack-depth-equal (stack depth)
+(defsubst context-coloring-stack-depth-equal (stack depth)
   (= (plist-get (car stack) :depth) depth))
 
-(defun context-coloring-exact-regexp (word)
+(defsubst context-coloring-exact-regexp (word)
   "Create a regexp that matches exactly WORD."
   (concat "\\`" (regexp-quote word) "\\'"))
 
-(defun context-coloring-exact-or-regexp (words)
+(defsubst context-coloring-exact-or-regexp (words)
   "Create a regexp that matches any exact word in WORDS."
   (context-coloring-join
    (mapcar 'context-coloring-exact-regexp words) "\\|"))
@@ -416,7 +416,7 @@ 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-emacs-lisp-iterations-per-pause 1000
+(defconst 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]