X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/f89ef19f5f80afb42ef8e24a0e2beaf6c7b4efeb..61b8c493c44211bb0d7ee0aab5883f51de129bf9:/packages/context-coloring/benchmark/context-coloring-benchmark.el diff --git a/packages/context-coloring/benchmark/context-coloring-benchmark.el b/packages/context-coloring/benchmark/context-coloring-benchmark.el index c2dd65316..1f5885c02 100644 --- a/packages/context-coloring/benchmark/context-coloring-benchmark.el +++ b/packages/context-coloring/benchmark/context-coloring-benchmark.el @@ -26,6 +26,7 @@ ;;; Code: (require 'context-coloring) +(require 'elp) (require 'js2-mode) @@ -115,7 +116,6 @@ with STATISTICS." callbacks. Measure the performance of all FIXTURES, calling CALLBACK when all are done." (funcall setup) - (elp-instrument-package "context-coloring-") (let ((result-file (context-coloring-benchmark-resolve-path (format "./logs/results-%s-%s.log" title (format-time-string "%s"))))) @@ -134,10 +134,12 @@ CALLBACK when all are done." original-function (lambda () (setq count (+ count 1)) - (push (- (float-time) colorization-start-time) colorization-times) - ;; Test 5 times. + ;; First 5 runs are for gathering real coloring times, + ;; unaffected by elp instrumentation. + (when (<= count 5) + (push (- (float-time) colorization-start-time) colorization-times)) (cond - ((= count 5) + ((= count 10) (advice-remove #'context-coloring-colorize advice) (context-coloring-benchmark-log-results result-file @@ -148,8 +150,14 @@ CALLBACK when all are done." :words (count-words (point-min) (point-max)) :colorization-times colorization-times :average-colorization-time (/ (apply #'+ colorization-times) 5))) + (elp-restore-all) (kill-buffer) (funcall callback)) + ;; The last 5 runs are for gathering function call and + ;; duration statistics. + ((= count 5) + (elp-instrument-package "context-coloring-") + (context-coloring-colorize)) (t (setq colorization-start-time (float-time)) (context-coloring-colorize))))))))