[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
excessive
+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
being
+manipulated.
This coloring scheme is probably more useful than conventional JavaScript
*syntax* highlighting. Highlighting keywords can help detect spelling errors,
or
-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))
+
(elp-results)
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
- [elpa] master 49f5e3e 079/271: Use alist of faces., (continued)
- [elpa] master 49f5e3e 079/271: Use alist of faces., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 8615688 089/271: Create tests., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 10d7726 077/271: Use custom JSON parser., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 099f434 082/271: Add optimizations for byte-compilation., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 0bfdbcd 085/271: Remove naive timers., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 4874e1e 086/271: Improve documentation and Makefile., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 43d2ca0 090/271: Remove unused monad., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 820becb 084/271: Fix test., Jackson Ray Hamilton, 2015/02/05
- [elpa] master fb57258 088/271: Reorder readme., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 426a7cd 083/271: Fix regression where existent definitions were missed., Jackson Ray Hamilton, 2015/02/05
- [elpa] master f8120d4 092/271: Update scenarios. Update readme.,
Jackson Ray Hamilton <=
- [elpa] master f50880d 091/271: Update header., Jackson Ray Hamilton, 2015/02/05
- [elpa] master a0139c3 087/271: Cleanup Makefile., Jackson Ray Hamilton, 2015/02/05
- [elpa] master f3e4d7b 094/271: Improve benchmarks., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 9ad5fb2 097/271: Update benchmark times., Jackson Ray Hamilton, 2015/02/05
- [elpa] master ab13a16 093/271: Add back optional timer. Improve docs., Jackson Ray Hamilton, 2015/02/05
- [elpa] master a321d8b 096/271: Update screenshot., Jackson Ray Hamilton, 2015/02/05
- [elpa] master c8a1710 100/271: Add message about needing Node.js., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 53cf944 099/271: Remove make from instructions., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 9f39f5c 095/271: More benchmark improvements., Jackson Ray Hamilton, 2015/02/05
- [elpa] master c7d1adf 103/271: Refactor Makefile., Jackson Ray Hamilton, 2015/02/05