[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master f3e4d7b 094/271: Improve benchmarks.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master f3e4d7b 094/271: Improve benchmarks. |
Date: |
Thu, 05 Feb 2015 18:30:03 +0000 |
branch: master
commit f3e4d7bf360f05f75ddfb2e36a46c1b306300f35
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Improve benchmarks.
---
Makefile | 3 +-
README.md | 10 +++---
benchmark/context-coloring-benchmark.el | 47 +++++++++++++++++++++++++++++++
benchmark/scenarios.el | 19 ------------
test/context-coloring-test.el | 4 +-
5 files changed, 56 insertions(+), 27 deletions(-)
diff --git a/Makefile b/Makefile
index 07313bb..656a035 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,8 @@ benchjs:
benchel:
emacs -Q -L . \
-l context-coloring \
- -l benchmark/scenarios.el
+ -l benchmark/context-coloring-benchmark \
+ -f context-coloring-benchmark-run
compile:
emacs -Q -batch -f batch-byte-compile *.el
diff --git a/README.md b/README.md
index deccbb8..f58c10b 100644
--- a/README.md
+++ b/README.md
@@ -29,11 +29,11 @@ can also be integrated into your workflow via [flycheck][].
## 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
+- Fast async AST parsing. Some total parse + recolor times:
+ - jQuery (9191 lines): 0.72 seconds
+ - Lodash (6786 lines): 0.40 seconds
+ - Async (1124 lines): 0.20 seconds
+ - mkdirp (98 lines): 0.09 seconds
## Usage
diff --git a/benchmark/context-coloring-benchmark.el
b/benchmark/context-coloring-benchmark.el
new file mode 100644
index 0000000..5476847
--- /dev/null
+++ b/benchmark/context-coloring-benchmark.el
@@ -0,0 +1,47 @@
+(defconst context-coloring-benchmark-path
+ (file-name-directory (or load-file-name buffer-file-name)))
+
+(defun context-coloring-benchmark-resolve-path (path)
+ (expand-file-name path context-coloring-benchmark-path))
+
+(defun context-coloring-benchmark-setup ()
+ (setq context-coloring-benchmark-colorization t)
+ (add-hook 'js-mode-hook 'context-coloring-mode)
+ (elp-instrument-package "context-coloring-"))
+
+(defun context-coloring-benchmark-teardown ()
+ (setq context-coloring-benchmark-colorization nil)
+ (remove-hook 'js-mode-hook 'context-coloring-mode))
+
+(defun context-coloring-benchmark-run ()
+ (context-coloring-benchmark-setup)
+ (let ((result-file (context-coloring-benchmark-resolve-path (concat
"./results.log"))))
+
+ (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"))
+
+ (let ((fixture (context-coloring-benchmark-resolve-path path)))
+
+ ;; Test 5 times.
+ (find-file fixture)
+ (dotimes (n 4)
+ (sit-for 1)
+ (revert-buffer t t))
+ (sit-for 1)
+
+ (elp-results)
+ (let ((results-buffer (current-buffer)))
+ (with-temp-buffer
+ (insert (concat fixture "\n"))
+ (prepend-to-buffer results-buffer (point-min) (point-max)))
+ (with-temp-buffer
+ (insert "\n")
+ (append-to-buffer results-buffer (point-min) (point-max))))
+
+ (append-to-file nil nil result-file)))
+
+ (find-file result-file))
+
+ (context-coloring-benchmark-teardown))
diff --git a/benchmark/scenarios.el b/benchmark/scenarios.el
deleted file mode 100644
index 7eed6ec..0000000
--- a/benchmark/scenarios.el
+++ /dev/null
@@ -1,19 +0,0 @@
-;; Setup
-(add-hook 'js-mode-hook 'context-coloring-mode)
-(elp-instrument-package "context-coloring-")
-
-(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/test/context-coloring-test.el b/test/context-coloring-test.el
index a8588fb..b942558 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -1,8 +1,8 @@
-(defconst context-coloring-path
+(defconst context-coloring-test-path
(file-name-directory (or load-file-name buffer-file-name)))
(defun context-coloring-test-resolve-path (path)
- (expand-file-name path context-coloring-path))
+ (expand-file-name path context-coloring-test-path))
;; Load expected output constants.
(load-file (context-coloring-test-resolve-path "./fixtures/scopes.el"))
- [elpa] master 099f434 082/271: Add optimizations for byte-compilation., (continued)
- [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, 2015/02/05
- [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 <=
- [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
- [elpa] master 3cd5c31 101/271: Typos., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 46f0986 105/271: Update readme., Jackson Ray Hamilton, 2015/02/05
- [elpa] master ab083f4 102/271: Simplify package.json., Jackson Ray Hamilton, 2015/02/05