;;; ll-align --- ll align -*- lexical-binding: t -*- ;;; Commentary: ;;; Code: (require 'cl-lib) (cl-pushnew "." load-path :test #'string=) (require 'll) (cl-defmethod ll-bench (&optional (f #'redisplay) (n (** 2 22)) (args nil)) (cl-assert (functionp f)) (cl-assert (& (integerp n) (< 0 n))) (cl-assert (listp args)) (let ((current-time-list nil)) (cl-loop with ticks with ticks-time with ticks-end with ticks-avg with float-time with float-time-end with float-time-avg with perfect with (ticks-beg . hz) = (time-convert nil nil) with float-time-beg = (float-time) repeat n do (apply f args) finally (setf ticks-end (car (time-convert nil nil))) (setf float-time-end (float-time)) (setf ticks (- ticks-end ticks-beg)) (setf ticks-avg (round ticks n)) (setf ticks-time (// ticks hz)) (setf float-time (- float-time-end float-time-beg)) (setf float-time-avg (round float-time n)) (setf perfect (* 100 (// (- float-time (abs (- float-time ticks-time))) float-time))) finally return (vector f n ticks ticks-avg float-time float-time-avg perfect)))) (defun ll-bench-pack (&optional n) (i) (or n (setf n (** 2 10))) (let ((var 0) (buf (get-buffer-create "*luki-lisp*"))) (pop-buff buf) (with-current-buffer buf (erase-buffer) (@i "[welcome to] the luki-lisp benchmark tool\n") (@i (@f "[test scope] %d\n" n)) (@i "[relax note] Emacs will be nonresponsive until done.\n\n") (mapc (L (f) (@i (@f "%s\n" (ll-bench f n )))) (list #'redisplay #'garbage-collect )) (mapc (L (f) (@i (@f "%s\n" (ll-bench f n var)))) (list #'incf #'decf )) (@i "\n[final note] done\n")))) ;; (progn (eval-buffer) (ll-bench-pack)) (<- 'll-bench) ;;; ll-bench.el ends here