From b485897a792781ace392951f8fe5f9f255b632fe Mon Sep 17 00:00:00 2001 From: Jackson Ray Hamilton Date: Tue, 30 Dec 2014 11:27:11 -0800 Subject: [PATCH] Update benchmarks. --- README.md | 10 +++++----- context-coloring.el | 12 +++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7e96bb78f..953624217 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,11 @@ code*. - Supported languages: JavaScript - Light and dark (customizable) color schemes. -- Fast async AST parsing. Some total parse + recolor times: - - jQuery (9191 lines): 0.63 seconds - - Lodash (6786 lines): 0.37 seconds - - Async (1124 lines): 0.17 seconds - - mkdirp (98 lines): 0.09 seconds +- Fast AST parsing. Some total parse + recolor times: + - jQuery (9191 lines): 0.43 seconds (js2-mode), 0.63 seconds (js-mode) + - Lodash (6786 lines): 0.19 seconds (js2-mode), 0.37 seconds (js-mode) + - Async (1124 lines): 0.05 seconds (js2-mode), 0.17 seconds (js-mode) + - mkdirp (98 lines): 0.005 seconds (js2-mode), 0.09 seconds (js-mode) ## Usage diff --git a/context-coloring.el b/context-coloring.el index 830fd9817..ea62a2870 100644 --- a/context-coloring.el +++ b/context-coloring.el @@ -67,6 +67,11 @@ ES6. If you are writing ES6 code, enable this; otherwise, don't. Supported modes: `js2-mode'" :group 'context-coloring) +(defcustom context-coloring-benchmark-colorization nil + "If non-nil, track how long colorization takes and print +messages with the colorization duration." + :group 'context-coloring) + ;;; Local variables @@ -416,7 +421,12 @@ of the current buffer, then does it." (defun context-coloring-colorize (&optional callback) "Colors the current buffer by function context." (interactive) - (context-coloring-dispatch callback)) + (let ((start-time (float-time))) + (context-coloring-dispatch + (lambda () + (when context-coloring-benchmark-colorization + (message "Colorization took %.3f seconds" (- (float-time) start-time))) + (if callback (funcall callback)))))) (defun context-coloring-change-function (_start _end _length) "Registers a change so that a context-colored buffer can be -- 2.39.2