1 (defconst context-coloring-benchmark-path
2 (file-name-directory (or load-file-name buffer-file-name)))
4 (defun context-coloring-benchmark-resolve-path (path)
5 (expand-file-name path context-coloring-benchmark-path))
7 (defun context-coloring-benchmark-setup ()
8 (setq context-coloring-benchmark-colorization t)
9 (add-hook 'js-mode-hook 'context-coloring-mode)
10 (elp-instrument-package "context-coloring-"))
12 (defun context-coloring-benchmark-teardown ()
13 (setq context-coloring-benchmark-colorization nil)
14 (remove-hook 'js-mode-hook 'context-coloring-mode))
16 (defun context-coloring-benchmark-run ()
17 (context-coloring-benchmark-setup)
18 (let ((result-file (context-coloring-benchmark-resolve-path (concat "./results.log"))))
20 (dolist (path '("./fixtures/jquery-2.1.1.js"
21 "./fixtures/lodash-2.4.1.js"
22 "./fixtures/async-0.9.0.js"
23 "./fixtures/mkdirp-0.5.0.js"))
25 (let ((fixture (context-coloring-benchmark-resolve-path path)))
35 (let ((results-buffer (current-buffer)))
37 (insert (concat fixture "\n"))
38 (prepend-to-buffer results-buffer (point-min) (point-max)))
41 (append-to-buffer results-buffer (point-min) (point-max))))
43 (append-to-file nil nil result-file)))
45 (find-file result-file))
47 (context-coloring-benchmark-teardown))