[Top][All Lists]

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

[elpa] master f8120d4 092/271: Update scenarios. Update readme.

From: Jackson Ray Hamilton
Subject: [elpa] master f8120d4 092/271: Update scenarios. Update readme.
Date: Thu, 05 Feb 2015 18:30:00 +0000

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

    Update scenarios. Update readme.
 README.md              |   30 ++++++++++++++++--------------
 benchmark/scenarios.el |   22 ++++++++++++++--------
 context-coloring.el    |    6 +++---
 3 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/README.md b/README.md
index 6735ff5..14a71d6 100644
--- a/README.md
+++ b/README.md
@@ -13,24 +13,26 @@ Highlights JavaScript code according to function context.
 - Identifiers are bold when first declared.
 - Comments are gray and italic.
-In JavaScript, we are constantly leveraging closures to bind nearby
-data. Lexical scope information at-a-glance can assist a programmer in
+JavaScript programmers often leverage closures to bind nearby data to
+functions. Lexical scope information at-a-glance can assist a programmer in
 understanding the overall structure of a program. It can also help curb nasty
-bugs like implicit globals and name shadowing, and act as an indicator of
-excessive complexity.
-There are some breakthrough advantages, too. Context coloring could enable a
-programmer to write in a functional style. It would be easy to tell when he had
-escaped the boundaries of his function and produced side-effects.
-Context coloring also improves a programmer's ability to write functions that
-construct objects with implicit private state (which is a good way to avoid
-`this` too).
+bugs, like implicit globals and name shadowing. A rainbow can indicate 
+complexity. A spot of contrast following by an assignment expression could be a
+side-effect... or, a specially-constructed object's private state could be 
 This coloring scheme is probably more useful than conventional JavaScript
 *syntax* highlighting. Highlighting keywords can help detect spelling errors, 
-alert one to unclosed string literals; but so can a [linter][]. (If you haven't
-already, you should [integrate][emacs integration] one into your editor.)
+alert one to unclosed string literals; but so can a [linter][].
+## Features
+- Light and dark color schemes.
+- Really fast async AST parsing. Some parse / recolor times:
+  - jQuery (9191 lines): 0.41 seconds
+  - lodash (6786 lines): 0.22 seconds
+  - Async (1124 lines): 28 milliseconds
+  - mkdirp (98 lines): instant
 ## Usage
diff --git a/benchmark/scenarios.el b/benchmark/scenarios.el
index 0a0287b..7eed6ec 100644
--- a/benchmark/scenarios.el
+++ b/benchmark/scenarios.el
@@ -2,12 +2,18 @@
 (add-hook 'js-mode-hook 'context-coloring-mode)
 (elp-instrument-package "context-coloring-")
-;; Test 5 times.
-(find-file (expand-file-name
-            "./fixtures/jquery-2.1.1.js"
-            (file-name-directory (or load-file-name buffer-file-name))))
-(dotimes (n 4)
-  (sit-for 2)
-  (revert-buffer t t))
-(sit-for 2)
+(dolist (path '("./fixtures/jquery-2.1.1.js"
+                "./fixtures/lodash-2.4.1.js"
+                "./fixtures/async-0.9.0.js"
+                "./fixtures/mkdirp-0.5.0.js"))
+  ;; Test 5 times.
+  (find-file (expand-file-name
+              path
+              (file-name-directory (or load-file-name buffer-file-name))))
+  (dotimes (n 4)
+    (sit-for 2)
+    (revert-buffer t t))
+  (sit-for 2))
diff --git a/context-coloring.el b/context-coloring.el
index 6393fef..2ddfccc 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -193,7 +193,7 @@ imply that it should be colorized again.")
   (expand-file-name "./bin/scopifier" context-coloring-path)
   "Path to the external scopifier executable.")
-(defsubst context-coloring-apply-tokens (tokens)
+(defun context-coloring-apply-tokens (tokens)
   "Processes TOKENS to apply context-based coloring to the
 current buffer. Tokens are vectors consisting of 4 integers:
 start, end, level, and style."
@@ -218,11 +218,11 @@ buffer."
     (delete-process context-coloring-scopifier-process)
     (setq context-coloring-scopifier-process nil)))
-(defsubst context-coloring-parse-array (input)
+(defun context-coloring-parse-array (input)
   "Specialized alternative JSON parser."
   (vconcat (mapcar 'string-to-number (split-string (substring input 1 -1) 
-(defsubst context-coloring-scopify ()
+(defun context-coloring-scopify ()
   "Invokes the external scopifier with the current buffer's
 contents, reading the scopifier's response asynchronously and
 applying a parsed list of tokens to

reply via email to

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