mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
enhancement: slightly better benchmarks
This commit is contained in:
parent
66aaf614f5
commit
1a9221cf0d
@ -4,6 +4,12 @@
|
|||||||
(split-string (buffer-string))))
|
(split-string (buffer-string))))
|
||||||
|
|
||||||
|
|
||||||
|
(defmacro yas/time (&rest body)
|
||||||
|
(let ((start-sym (gensym)))
|
||||||
|
`(let ((,start-sym (current-time)))
|
||||||
|
,@body
|
||||||
|
(float-time (time-subtract (current-time) ,start-sym)))))
|
||||||
|
|
||||||
(defun yas/run-some-benchmarks ()
|
(defun yas/run-some-benchmarks ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((dummy-mode-names (subseq manywords 0 10))
|
(let* ((dummy-mode-names (subseq manywords 0 10))
|
||||||
@ -17,52 +23,49 @@
|
|||||||
dummy-mode-names)))
|
dummy-mode-names)))
|
||||||
(yas/verbosity 1))
|
(yas/verbosity 1))
|
||||||
(with-current-buffer (get-buffer-create "*yas/benchmarks*")
|
(with-current-buffer (get-buffer-create "*yas/benchmarks*")
|
||||||
(erase-buffer)
|
(end-of-buffer)
|
||||||
|
(insert (format "\nComparison of `yas/reload-all' performance: (%s)\n\n" (current-time-string)))
|
||||||
;; jit, no compiled, fastest
|
;; jit, no compiled, fastest
|
||||||
;;
|
;;
|
||||||
(yas/with-snippet-dirs (list dummy-snippets)
|
(yas/with-snippet-dirs (list dummy-snippets)
|
||||||
;; (yas/recompile-all)
|
;; (yas/recompile-all)
|
||||||
(let ((start (current-time)))
|
(let ((yas/auto-compile-snippets nil))
|
||||||
(yas/reload-all)
|
(insert (format "JIT NO-COMPILED NO-AUTOCOMP: %s s\n"
|
||||||
(insert (format "JIT NO-COMPILED: %s s\n" (float-time (time-subtract (current-time) start))))))
|
(yas/time (yas/reload-all))))))
|
||||||
;; jit, compiled, this is equivalent to the first one. The real work
|
;; jit, compiled, this is equivalent to the first one. The real work
|
||||||
;; will be done when modes are effectively accessed
|
;; will be done when modes are effectively accessed
|
||||||
;;
|
;;
|
||||||
(yas/with-snippet-dirs (list dummy-snippets)
|
(yas/with-snippet-dirs (list dummy-snippets)
|
||||||
(let ((start (current-time)))
|
(let ((yas/auto-compile-snippets nil))
|
||||||
(yas/reload-all)
|
(insert (format "JIT COMPILED NO-AUTOCOMP: %s s (identical to the previous case, no snippets are actually loaded)\n"
|
||||||
(insert (format "JIT COMPILED: %s s\n" (float-time (time-subtract (current-time) start))))))
|
(yas/time (yas/reload-all))))))
|
||||||
;; no-jit no-compiled files, slow
|
;; no-jit no-compiled files, slow
|
||||||
;;
|
;;
|
||||||
(yas/with-snippet-dirs (list dummy-snippets)
|
(yas/with-snippet-dirs (list dummy-snippets)
|
||||||
(let ((start (current-time))
|
(let ((yas/auto-compile-snippets nil))
|
||||||
(yas/auto-compile-snippets nil))
|
(insert (format "NO-JIT NO-COMPILED NO-AUTOCOMP: %s s (every snippet loaded from file)\n"
|
||||||
(yas/reload-all t)
|
(yas/time (yas/reload-all t))))))
|
||||||
(insert (format "NO-JIT NO-COMPILED: %s s\n" (float-time (time-subtract (current-time) start))))))
|
|
||||||
;; no-jit compiled files, this is what normally happens when a user
|
;; no-jit compiled files, this is what normally happens when a user
|
||||||
;; interactive calls `yas/reload-all'
|
;; interactive calls `yas/reload-all'
|
||||||
;;
|
;;
|
||||||
(yas/with-snippet-dirs (list dummy-snippets)
|
(yas/with-snippet-dirs (list dummy-snippets)
|
||||||
(yas/recompile-all)
|
(yas/recompile-all)
|
||||||
(let ((start (current-time))
|
(let ((yas/auto-compile-snippets nil))
|
||||||
(yas/auto-compile-snippets nil))
|
(insert (format "NO-JIT COMPILED NO-AUTOCOMP: %s s (no recompilation-needed)\n"
|
||||||
(yas/reload-all t)
|
(yas/time (yas/reload-all t))))))
|
||||||
(insert (format "NO-JIT COMPILED: %s s (no recompilation-needed, no auto-compilation checks)\n" (float-time (time-subtract (current-time) start))))))
|
|
||||||
;; no-jit compiled files, this is what normally happens when a
|
;; no-jit compiled files, this is what normally happens when a
|
||||||
;; user interactive calls `yas/reload-all', but now with
|
;; user interactive calls `yas/reload-all', but now with
|
||||||
;; auto-compilation `mtime' checks
|
;; auto-compilation `mtime' checks
|
||||||
;;
|
;;
|
||||||
(yas/with-snippet-dirs (list dummy-snippets)
|
(yas/with-snippet-dirs (list dummy-snippets)
|
||||||
(yas/recompile-all)
|
(yas/recompile-all)
|
||||||
(let ((start (current-time))
|
(let ((yas/auto-compile-snippets t))
|
||||||
(yas/auto-compile-snippets t))
|
(insert (format "NO-JIT COMPILED AUTOCOMP: %s s (no recompilation needed, just compilation checks)\n"
|
||||||
(yas/reload-all t)
|
(yas/time (yas/reload-all t))))))
|
||||||
(insert (format "NO-JIT COMPILED: %s s (no recompilation needed, auto-compilation checks)\n" (float-time (time-subtract (current-time) start))))))
|
|
||||||
;; no-jit no previous compilation, the autocompilation case, slowest
|
;; no-jit no previous compilation, the autocompilation case, slowest
|
||||||
;;
|
;;
|
||||||
(yas/with-snippet-dirs (list dummy-snippets)
|
(yas/with-snippet-dirs (list dummy-snippets)
|
||||||
(let ((start (current-time))
|
(let ((yas/auto-compile-snippets t))
|
||||||
(yas/auto-compile-snippets t))
|
(insert (format "NO-JIT NO-COMPILED AUTOCOMP: %s s (recompilation needed, auto-compilation kicks in all dirs)\n"
|
||||||
(yas/reload-all t)
|
(yas/time (yas/reload-all t))))))
|
||||||
(insert (format "NO-JIT NO-COMPILED: %s s (recompilation needed, auto-compilation kicks in all dirs)\n" (float-time (time-subtract (current-time) start))))))
|
|
||||||
(pop-to-buffer (current-buffer)))))
|
(pop-to-buffer (current-buffer)))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user