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)
19 (let ((result-file (context-coloring-benchmark-resolve-path
20 (concat "./results-" (format-time-string "%s") ".log"))))
22 (dolist (path '("./fixtures/jquery-2.1.1.js"
23 "./fixtures/lodash-2.4.1.js"
24 "./fixtures/async-0.9.0.js"
25 "./fixtures/mkdirp-0.5.0.js"))
27 (let ((fixture (context-coloring-benchmark-resolve-path path)))
37 (let ((results-buffer (current-buffer)))
39 (insert (concat fixture "\n"))
40 (prepend-to-buffer results-buffer (point-min) (point-max)))
43 (append-to-buffer results-buffer (point-min) (point-max))))
45 (append-to-file nil nil result-file))))
47 (context-coloring-benchmark-teardown)