nix-archive-1(type directoryentry(namesharenode(type directoryentry(nameemacsnode(type directoryentry(name site-lispnode(type directoryentry(namebenchmark-init-1.2node(type directoryentry(namebenchmark-init-autoloads.elnode(typeregularcontents;;; benchmark-init-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*- ;; Generated by the `loaddefs-generate' function. ;; This file is part of GNU Emacs. ;;; Code: ;;; Generated autoloads from benchmark-init.el (autoload 'benchmark-init/activate "benchmark-init" "\ Activate benchmark-init and start collecting data." t) (register-definition-prefixes "benchmark-init" '("benchmark-init/")) ;;; Generated autoloads from benchmark-init-modes.el (autoload 'benchmark-init/show-durations-tabulated "benchmark-init-modes" "\ Show the benchmark results in a sorted table. ROOT is the root of the tree to show durations for. If nil, it defaults to `benchmark-init/durations-tree'. (fn &optional ROOT)" t) (autoload 'benchmark-init/show-durations-tree "benchmark-init-modes" "\ Show durations in call-tree. ROOT is the root of the tree to show durations for. If nil, it defaults to `benchmark-init/durations-tree'. (fn &optional ROOT)" t) (register-definition-prefixes "benchmark-init-modes" '("benchmark-init/")) ;;; End of scraped data (provide 'benchmark-init-autoloads) ;; Local Variables: ;; version-control: never ;; no-update-autoloads: t ;; no-native-compile: t ;; coding: utf-8-emacs-unix ;; End: ;;; benchmark-init-autoloads.el ends here ))entry(namebenchmark-init-autoloads.elcnode(typeregularcontents;ELC ;;; Compiled ;;; in Emacs version 29.4 ;;; with all optimizations. (when (boundp 'comp--no-native-compile) (puthash load-file-name t comp--no-native-compile)) #@52 Activate benchmark-init and start collecting data. (autoload 'benchmark-init/activate "benchmark-init" '(#$ . 178) t) (register-definition-prefixes "benchmark-init" '("benchmark-init/"))#@177 Show the benchmark results in a sorted table. ROOT is the root of the tree to show durations for. If nil, it defaults to `benchmark-init/durations-tree'. (fn &optional ROOT) (autoload 'benchmark-init/show-durations-tabulated "benchmark-init-modes" '(#$ . 371) t)#@160 Show durations in call-tree. ROOT is the root of the tree to show durations for. If nil, it defaults to `benchmark-init/durations-tree'. (fn &optional ROOT) (autoload 'benchmark-init/show-durations-tree "benchmark-init-modes" '(#$ . 642) t) (byte-code "\300\301\302\"\210\303\304!\207" [register-definition-prefixes "benchmark-init-modes" ("benchmark-init/") provide benchmark-init-autoloads] 3) ))entry(namebenchmark-init-modes.elnode(typeregularcontents!;;; benchmark-init-modes.el --- Modes for presenting benchmark results. -*- lexical-binding: t; package-lint-main-file: "benchmark-init.el"; -*- ;; Copyright (C) 2014 David Holm ;; Author: David Holm ;; Created: 05 Apr 2014 ;; This file is not part of GNU Emacs. ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This file is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this file. If not, see . ;;; Commentary: ;;; Installation: ;; See `benchmark-init.el'. ;;; Usage: ;; Results can be presented either in a tabulated list mode, or as a tree of ;; accumulated durations: ;; ;; - `benchmark-init/show-durations-tabulated' ;; - `benchmark-init/show-durations-tree' ;;; Code: (require 'benchmark-init) (require 'cl-lib) ;; Faces (defgroup benchmark-init/faces nil "Faces used by benchmark-init." :group 'benchmark-init :group 'faces) (defface benchmark-init/header-face '((t :inherit font-lock-keyword-face :bold t)) "Face for benchmark init header." :group 'benchmark-init/faces) (defface benchmark-init/name-face '((t :inherit font-lock-variable-name-face)) "Face for entry name." :group 'benchmark-init/faces) (defface benchmark-init/type-face '((t :inherit font-lock-type-face)) "Face for entry type." :group 'benchmark-init/faces) (defface benchmark-init/duration-face '((t :inherit font-lock-constant-face)) "Face for entry duration." :group 'benchmark-init/faces) ;; Constants (defconst benchmark-init/buffer-name "*Benchmark Init Results %s*" "Name of benchmark-init list buffer.") (defconst benchmark-init/list-format [("Module" 65 t) ("Type" 7 t) ("ms" 7 (lambda (a b) (< (string-to-number (aref (cadr a) 2)) (string-to-number (aref (cadr b) 2)))) :right-align t) ("total ms" 7 (lambda (a b) (< (string-to-number (aref (cadr a) 3)) (string-to-number (aref (cadr b) 3)))) :right-align t)] "Benchmark list format.") (defconst benchmark-init/list-sort-key '("ms" . t) "Benchmark list sort key.") ;; Global variables (defvar benchmark-init/tree-mode-hook nil "Hook run when entering the tree presentation mode.") (defvar benchmark-init/tree-mode-map (let ((map (copy-keymap special-mode-map))) (set-keymap-parent map button-buffer-map) (define-key map "n" 'next-line) (define-key map "p" 'previous-line) map) "Local keymap for `benchmark-init/tree-mode' buffers.") (defvar-local benchmark-init/display-root nil "Root of display in a benchmark buffer.") ;; Tabulated presentation mode (define-derived-mode benchmark-init/tabulated-mode tabulated-list-mode "Benchmark Init Tabulated" "Mode for displaying benchmark-init results in a table." (setq tabulated-list-format benchmark-init/list-format) (setq tabulated-list-padding 2) (setq tabulated-list-sort-key benchmark-init/list-sort-key) (tabulated-list-init-header)) (defun benchmark-init/list-entries () "Generate benchmark-init list entries from durations tree." (let (entries) (mapc (lambda (value) (let ((name (cdr (assq :name value))) (type (symbol-name (cdr (assq :type value)))) (duration (round (cdr (assq :duration value)))) (duration-adj (round (cdr (assq :duration-adj value))))) (push (list name `[,name ,type ,(number-to-string duration-adj) ,(number-to-string duration)]) entries))) (cdr (benchmark-init/flatten benchmark-init/display-root))) entries)) ;;;###autoload (defun benchmark-init/show-durations-tabulated (&optional root) "Show the benchmark results in a sorted table. ROOT is the root of the tree to show durations for. If nil, it defaults to `benchmark-init/durations-tree'." (interactive) (setq root (or root benchmark-init/durations-tree)) (unless (featurep 'tabulated-list) (require 'tabulated-list)) (let ((buffer-name (format benchmark-init/buffer-name "Tabulated"))) (with-current-buffer (get-buffer-create buffer-name) (benchmark-init/tabulated-mode) (setq benchmark-init/display-root root) (setq tabulated-list-entries 'benchmark-init/list-entries) (tabulated-list-print t) (switch-to-buffer (current-buffer))))) ;; Tree presentation (defun benchmark-init/print-header () "Print the presentation header." (insert (propertize "Benchmark results" 'face 'benchmark-init/header-face) "\n\n")) (defun benchmark-init/print-node (padding node) "Print PADDING followed by NODE." (let ((name (benchmark-init/node-name node)) (type (symbol-name (benchmark-init/node-type node))) (duration (benchmark-init/node-duration-adjusted node))) (insert padding "[" (propertize (format "%s" name) 'face 'benchmark-init/name-face) " " (propertize (format "%s" type) 'face 'benchmark-init/type-face) " " (propertize (format "%dms" (round duration)) 'face 'benchmark-init/duration-face) "]\n"))) (defun benchmark-init/print-nodes (nodes padding) "Print NODES after PADDING." (cl-mapl (lambda (cons) (let ((x (car cons)) (xs (cdr cons))) (let ((children (benchmark-init/node-children x)) (cur-padding (concat padding (if xs "├─" "╰─"))) (sub-padding (concat padding (if xs "│ " " ")))) (if (benchmark-init/node-root-p x) (benchmark-init/print-node "╼►" x) (benchmark-init/print-node cur-padding x)) (when children (benchmark-init/print-nodes children sub-padding))))) (reverse nodes))) (defun benchmark-init/tree-buffer-setup () "Configure the buffer for the durations tree." (let ((inhibit-read-only t)) (erase-buffer) (remove-overlays) (benchmark-init/print-header) (benchmark-init/print-nodes (list benchmark-init/display-root) "")) (use-local-map benchmark-init/tree-mode-map) (goto-char (point-min))) (defun benchmark-init/tree-mode (root) "Major mode for presenting durations in ROOT. ROOT is the root of a tree of `benchmark-init/node'." (kill-all-local-variables) (setq buffer-read-only t) (setq truncate-lines t) (use-local-map benchmark-init/tree-mode-map) (setq major-mode 'benchmark-init/tree-mode) (setq mode-name "Benchmark Init Tree") (setq benchmark-init/display-root root) (benchmark-init/tree-buffer-setup) (run-mode-hooks 'benchmark-init/tree-mode-hook)) (put 'benchmark-init/tree-mode 'mode-class 'special) ;;;###autoload (defun benchmark-init/show-durations-tree (&optional root) "Show durations in call-tree. ROOT is the root of the tree to show durations for. If nil, it defaults to `benchmark-init/durations-tree'." (interactive) (setq root (or root benchmark-init/durations-tree)) (let ((buffer-name (format benchmark-init/buffer-name "Tree"))) (switch-to-buffer (get-buffer-create buffer-name)) (if (not (and (eq major-mode 'benchmark-init/tree-mode) (eq benchmark-init/display-root root))) (benchmark-init/tree-mode root)))) ;; Obsolete functions (define-obsolete-function-alias 'benchmark-init/show-durations 'benchmark-init/show-durations-tabulated "2014-04-05") (provide 'benchmark-init-modes) ;;; benchmark-init-modes.el ends here ))entry(namebenchmark-init-modes.elcnode(typeregularcontentsI";ELC ;;; Compiled ;;; in Emacs version 29.4 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\303\304\305\306\307\301\307\310&\207" [require benchmark-init cl-lib custom-declare-group benchmark-init/faces nil "Faces used by benchmark-init." :group faces] 8) (custom-declare-face 'benchmark-init/header-face '((t :inherit font-lock-keyword-face :bold t)) "Face for benchmark init header." :group 'benchmark-init/faces) (custom-declare-face 'benchmark-init/name-face '((t :inherit font-lock-variable-name-face)) "Face for entry name." :group 'benchmark-init/faces) (custom-declare-face 'benchmark-init/type-face '((t :inherit font-lock-type-face)) "Face for entry type." :group 'benchmark-init/faces) (custom-declare-face 'benchmark-init/duration-face '((t :inherit font-lock-constant-face)) "Face for entry duration." :group 'benchmark-init/faces)#@37 Name of benchmark-init list buffer. (defconst benchmark-init/buffer-name "*Benchmark Init Results %s*" (#$ . 876))#@24 Benchmark list format. (defconst benchmark-init/list-format [("Module" 65 t) ("Type" 7 t) ("ms" 7 (lambda (a b) (< (string-to-number (aref (cadr a) 2)) (string-to-number (aref (cadr b) 2)))) :right-align t) ("total ms" 7 (lambda (a b) (< (string-to-number (aref (cadr a) 3)) (string-to-number (aref (cadr b) 3)))) :right-align t)] (#$ . 996))#@26 Benchmark list sort key. (defconst benchmark-init/list-sort-key '("ms" . t) (#$ . 1344))#@52 Hook run when entering the tree presentation mode. (defvar benchmark-init/tree-mode-hook nil (#$ . 1438))#@54 Local keymap for `benchmark-init/tree-mode' buffers. (defvar benchmark-init/tree-mode-map (byte-code "\302!\303 \"\210\304\305\306#\210\304\307\310#\210\207" [special-mode-map button-buffer-map copy-keymap set-keymap-parent define-key "n" next-line "p" previous-line] 5) (#$ . 1549))#@40 Root of display in a benchmark buffer. (defvar benchmark-init/display-root nil (#$ . 1842)) (make-variable-buffer-local 'benchmark-init/display-root) (defvar benchmark-init/tabulated-mode-hook nil) (byte-code "\300\301N\204\f\302\300\301\303#\210\304\305!\204\302\305\306\307#\210\300\207" [benchmark-init/tabulated-mode-hook variable-documentation put "Hook run after entering Benchmark Init Tabulated mode.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" boundp benchmark-init/tabulated-mode-map definition-name benchmark-init/tabulated-mode] 4) (defvar benchmark-init/tabulated-mode-map (make-sparse-keymap)) (byte-code "\301\302N\204\303\301\302\304\305!#\210\306\307!\204*\303\307\310\311#\210\312\307\306\307!\203&\313\202(\314 \"\210\307\302N\2048\303\307\302\304\315!#\210\306\300!\204X\303\300\310\311#\210\312\300\306\300!\203P\313\202V\316\300\313\"\210\"\210\300\302N\204f\303\300\302\304\317!#\210\303\311\320\321#\207" [benchmark-init/tabulated-mode-abbrev-table benchmark-init/tabulated-mode-map variable-documentation put purecopy "Keymap for `benchmark-init/tabulated-mode'." boundp benchmark-init/tabulated-mode-syntax-table definition-name benchmark-init/tabulated-mode defvar-1 nil make-syntax-table "Syntax table for `benchmark-init/tabulated-mode'." define-abbrev-table "Abbrev table for `benchmark-init/tabulated-mode'." derived-mode-parent tabulated-list-mode] 5)#@292 Mode for displaying benchmark-init results in a table. In addition to any hooks its parent mode `tabulated-list-mode' might have run, this mode runs the hook `benchmark-init/tabulated-mode-hook', as the final or penultimate step during initialization. \{benchmark-init/tabulated-mode-map} (defalias 'benchmark-init/tabulated-mode #[0 "\306\300!\210\307\310 \210\311\312\310\313N\203\314\311\313\310\313N#\210\315 !\204'\316 \317 \"\210\320\f!\211\2035\211\321 =\203;\322\f\323 \"\210\210\324 \325\"\204R =\204R\326 \325C#\210\327 !\210\330\f!\210 \331 !\"\332 )\210\333\334!\207" [delay-mode-hooks major-mode mode-name benchmark-init/tabulated-mode-map benchmark-init/tabulated-mode-syntax-table benchmark-init/tabulated-mode-abbrev-table make-local-variable t tabulated-list-mode benchmark-init/tabulated-mode "Benchmark Init Tabulated" mode-class put keymap-parent set-keymap-parent current-local-map char-table-parent standard-syntax-table set-char-table-parent syntax-table abbrev-table-get :parents abbrev-table-put use-local-map set-syntax-table 2 tabulated-list-init-header run-mode-hooks benchmark-init/tabulated-mode-hook local-abbrev-table benchmark-init/list-format tabulated-list-format tabulated-list-padding benchmark-init/list-sort-key tabulated-list-sort-key] 5 (#$ . 3330) nil])#@59 Generate benchmark-init list entries from durations tree. (defalias 'benchmark-init/list-entries #[0 "\301C\302\303\304\"\305!A\"\210\211\242\207" [benchmark-init/display-root nil mapc make-closure #[257 "\301\236A\302\303\236A!\304\305\236A!\304\306\236A!\300\307\310!\310!$D\300\242B\240\207" [V0 :name symbol-name :type round :duration :duration-adj vector number-to-string] 13 "\n\n(fn VALUE)"] benchmark-init/flatten] 5 (#$ . 4656)])#@177 Show the benchmark results in a sorted table. ROOT is the root of the tree to show durations for. If nil, it defaults to `benchmark-init/durations-tree'. (fn &optional ROOT) (defalias 'benchmark-init/show-durations-tabulated #[256 "\211\206\262\304\305!\204\306\305!\210\307 \310\"r\311!q\210\312 \210\313\314\315!\210\316p!)\207" [benchmark-init/durations-tree benchmark-init/buffer-name benchmark-init/display-root tabulated-list-entries featurep tabulated-list require format "Tabulated" get-buffer-create benchmark-init/tabulated-mode benchmark-init/list-entries tabulated-list-print t switch-to-buffer] 4 (#$ . 5116) nil])#@32 Print the presentation header. (defalias 'benchmark-init/print-header #[0 "\300\301\302\303#\304\261\207" [propertize "Benchmark results" face benchmark-init/header-face "\n\n"] 4 (#$ . 5761)])#@52 Print PADDING followed by NODE. (fn PADDING NODE) (defalias 'benchmark-init/print-node #[514 "\301!>\204\302\303\304D\"\210\211\305H\306\301!>\204\"\302\303\304D\"\210\307H!\310!\311\312\313\314\"\315\316#\317\312\313\314\"\315\320#\317\312\313\321\322\n!\"\315\323#\324\261\207" [cl-struct-benchmark-init/node-tags type-of signal wrong-type-argument benchmark-init/node 1 symbol-name 2 benchmark-init/node-duration-adjusted "[" propertize format "%s" face benchmark-init/name-face " " benchmark-init/type-face "%dms" round benchmark-init/duration-face "]\n"] 16 (#$ . 5961)])#@48 Print NODES after PADDING. (fn NODES PADDING) (defalias 'benchmark-init/print-nodes #[514 "\300\301\302\"\303!\"\207" [cl-mapl make-closure #[257 "\211@A\302! >\204\303\304\305D\"\210\306H\300\203\307\202 \310P\300\203*\311\202+\312P\313!\203;\314\315\"\210\202A\314\"\210\205I\316\"\207" [V0 cl-struct-benchmark-init/node-tags type-of signal wrong-type-argument benchmark-init/node 4 "├─" "╰─" "│ " " " benchmark-init/node-root-p benchmark-init/print-node "╼►" benchmark-init/print-nodes] 9 "\n\n(fn CONS)"] reverse] 6 (#$ . 6562)])#@46 Configure the buffer for the durations tree. (defalias 'benchmark-init/tree-buffer-setup #[0 "\303\304 \210\305 \210\306 \210\307 C\310\")\210\311\n!\210eb\207" [inhibit-read-only benchmark-init/display-root benchmark-init/tree-mode-map t erase-buffer remove-overlays benchmark-init/print-header benchmark-init/print-nodes "" use-local-map] 3 (#$ . 7144)])#@110 Major mode for presenting durations in ROOT. ROOT is the root of a tree of `benchmark-init/node'. (fn ROOT) (defalias 'benchmark-init/tree-mode #[257 "\306 \210\307\211\310\n!\210\311\312\211\313 \210\314\315!\207" [buffer-read-only truncate-lines benchmark-init/tree-mode-map major-mode mode-name benchmark-init/display-root kill-all-local-variables t use-local-map benchmark-init/tree-mode "Benchmark Init Tree" benchmark-init/tree-buffer-setup run-mode-hooks benchmark-init/tree-mode-hook] 4 (#$ . 7508)]) (put 'benchmark-init/tree-mode 'mode-class 'special)#@160 Show durations in call-tree. ROOT is the root of the tree to show durations for. If nil, it defaults to `benchmark-init/durations-tree'. (fn &optional ROOT) (defalias 'benchmark-init/show-durations-tree #[256 "\211\206\262\304 \305\"\306\307!!\210\n\310=\205 =?\205!\310!\207" [benchmark-init/durations-tree benchmark-init/buffer-name major-mode benchmark-init/display-root format "Tree" switch-to-buffer get-buffer-create benchmark-init/tree-mode] 5 (#$ . 8082) nil]) (byte-code "\300\301\302\303#\210\304\301\302\305#\210\306\307!\207" [defalias benchmark-init/show-durations benchmark-init/show-durations-tabulated nil make-obsolete "2014-04-05" provide benchmark-init-modes] 4) ))entry(namebenchmark-init-pkg.elnode(typeregularcontentsD;;; Generated package description from benchmark-init.el -*- no-byte-compile: t -*- (define-package "benchmark-init" "1.2" "Benchmarks for require and load calls" '((emacs "24.3")) :maintainer '("David Holm" . "dholmster@gmail.com") :keywords '("convenience" "benchmark") :url "https://github.com/dholm/benchmark-init-el") ))entry(namebenchmark-init.elnode(typeregularcontents»;;; benchmark-init.el --- Benchmarks for require and load calls -*- lexical-binding: t; -*- ;; Copyright (C) 2013 Steve Purcell ;; Copyright (C) 2013-2014 David Holm ;; Author: Steve Purcell ;; Maintainer: David Holm ;; Created: 25 Apr 2013 ;; Keywords: convenience benchmark ;; Version: 1.2 ;; URL: https://github.com/dholm/benchmark-init-el ;; Package-Requires: ((emacs "24.3")) ;; This file is not part of GNU Emacs. ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This file is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this file. If not, see . ;;; Commentary: ;; This is a simple benchmark of calls to Emacs require and load functions. ;; It can be used to keep track of where time is being spent during Emacs ;; startup in order to optimize startup times. ;; The code is based on init-benchmarking.el by Steve Purcell. ;;; Installation: ;; Place this file in your load path and add the following code to the ;; beginning of your Emacs initialization script: ;; (require 'benchmark-init) ;; Data collection will begin as soon as benchmark-init has been loaded. ;;; Usage: ;; After Emacs has finished loading the following functions will bring up ;; the results: ;; ;; - `benchmark-init/show-durations-tabulated' ;; - `benchmark-init/show-durations-tree' ;; ;; Data collection can be controlled using the following two functions: ;; ;; - `benchmark-init/activate' ;; - `benchmark-init/deactivate' ;;; Code: (require 'cl-lib) ;; Customization (defgroup benchmark-init nil "Emacs init benchmarking." :group 'local) ;; Global variables (cl-defstruct benchmark-init/node "Tree node structure. Slots: `name' Entry name. `type' Entry type, such as 'require or 'load. `duration' Duration in milliseconds. `children' Nodes loaded by this one." name type duration children) (defvar benchmark-init/durations-tree (make-benchmark-init/node :name 'benchmark-init/root :type nil :duration 0 :children nil) "Recorded durations stored in a tree.") (defvar benchmark-init/current-node benchmark-init/durations-tree "Current node in durations tree.") ;; Helpers (defun benchmark-init/time-subtract-millis (b a) "Calculate the number of milliseconds that have elapsed between B and A." (* 1000.0 (float-time (time-subtract b a)))) (defun benchmark-init/flatten (node) "Flatten NODE into a property list." (let ((node-alist `((:name . ,(benchmark-init/node-name node)) (:type . ,(benchmark-init/node-type node)) (:duration . ,(benchmark-init/node-duration node)) (:duration-adj . ,(benchmark-init/node-duration-adjusted node)))) (children (benchmark-init/node-children node)) (node-list)) (cons node-alist (dolist (child children node-list) (setq node-list (append (benchmark-init/flatten child) node-list)))))) (defun benchmark-init/node-root-p (node) "True if NODE represents the tree root." (eq benchmark-init/durations-tree node)) (defun benchmark-init/node-duration-adjusted (node) "Duration of NODE with child durations removed." (let ((duration (benchmark-init/node-duration node)) (child-durations (benchmark-init/sum-node-durations (benchmark-init/node-children node)))) (if (benchmark-init/node-root-p node) child-durations (- duration child-durations)))) (defun benchmark-init/sum-node-durations (nodes) "Return the sum of NODES durations." (let ((accum 0)) (dolist (node nodes accum) (setq accum (+ (benchmark-init/node-duration node) accum))))) ;; Benchmark helpers (defun benchmark-init/begin-measure (name type) "Begin measuring NAME of TYPE." (let ((parent benchmark-init/current-node) (node (make-benchmark-init/node :name name :type type :duration (current-time) :children nil))) (setq benchmark-init/current-node node) parent)) (defun benchmark-init/end-measure (parent should-record-p) "Stop measuring and store to PARENT if SHOULD-RECORD-P." (let ((node benchmark-init/current-node) (duration (benchmark-init/time-subtract-millis (current-time) (benchmark-init/node-duration benchmark-init/current-node)))) (when (funcall should-record-p) (setf (benchmark-init/node-duration node) duration) (push node (benchmark-init/node-children parent))) (setq benchmark-init/current-node parent))) (defmacro benchmark-init/measure-around (name type inner should-record-p) "Save duration spent in NAME of TYPE around INNER if SHOULD-RECORD-P." `(let ((parent (benchmark-init/begin-measure ,name ,type))) (prog1 ,inner (benchmark-init/end-measure parent ,should-record-p)))) ;; Benchmark injection (defadvice require (around build-require-durations (feature &optional filename noerror) activate) "Record the time taken to require FEATURE." (let* ((name (symbol-name feature)) (already-loaded (memq feature features)) (should-record-p (lambda () (and (not already-loaded) (memq feature features))))) (benchmark-init/measure-around name 'require ad-do-it should-record-p))) (defadvice load (around build-load-durations (file &optional noerror nomessage nosuffix must-suffix) activate) "Record the time taken to load FILE." (let ((name (abbreviate-file-name file)) (should-record-p (lambda () t))) (benchmark-init/measure-around name 'load ad-do-it should-record-p))) ;; Benchmark control (defun benchmark-init/deactivate () "Deactivate benchmark-init." (interactive) (ad-deactivate 'require) (ad-deactivate 'load)) ;;;###autoload (defun benchmark-init/activate () "Activate benchmark-init and start collecting data." (interactive) (ad-activate 'require) (ad-activate 'load)) ;; Obsolete functions (define-obsolete-function-alias 'benchmark-init/install 'benchmark-init/activate "2014-03-17") (provide 'benchmark-init) ;;; benchmark-init.el ends here ))entry(namebenchmark-init.elcnode(typeregularcontentsµ*;ELC ;;; Compiled ;;; in Emacs version 29.4 ;;; with all optimizations. (byte-code "\300\301!\210\302\303\304\305\306\307%\207" [require cl-lib custom-declare-group benchmark-init nil "Emacs init benchmarking." :group local] 6)#@78 compiler-macro for inlining `benchmark-init/node-p'. (fn CL-WHOLE-ARG CL-X) (defalias 'benchmark-init/node-p--cmacro #[514 "\300\301\302\303\211\211&\207" [cl--defsubst-expand (cl-x) (cl-block benchmark-init/node-p (and (memq (type-of cl-x) cl-struct-benchmark-init/node-tags) t)) nil] 9 (#$ . 239)]) (byte-code "\300\301\302\303#\300\207" [define-symbol-prop benchmark-init/node-p compiler-macro benchmark-init/node-p--cmacro] 4)#@13 (fn CL-X) (defalias 'benchmark-init/node-p #[257 "\301!>\205 \302\207" [cl-struct-benchmark-init/node-tags type-of t] 3 (#$ . 679)]) (byte-code "\300\301\302\303#\300\301\304\305#\306\307\310\301#\300\207" [function-put benchmark-init/node-p side-effect-free error-free pure t define-symbol-prop benchmark-init/node cl-deftype-satisfies] 6)#@81 compiler-macro for inlining `benchmark-init/node-name'. (fn CL-WHOLE-ARG CL-X) (defalias 'benchmark-init/node-name--cmacro #[514 "\300\301\302\303\211\211&\207" [cl--defsubst-expand (cl-x) (cl-block benchmark-init/node-name (progn (or (benchmark-init/node-p cl-x) (signal 'wrong-type-argument (list 'benchmark-init/node cl-x))) (aref cl-x 1))) nil] 9 (#$ . 1030)]) (byte-code "\300\301\302\303#\300\207" [define-symbol-prop benchmark-init/node-name compiler-macro benchmark-init/node-name--cmacro] 4)#@69 Access slot "name" of `benchmark-init/node' struct CL-X. (fn CL-X) (defalias 'benchmark-init/node-name #[257 "\301!>\204\302\303\304D\"\210\211\305H\207" [cl-struct-benchmark-init/node-tags type-of signal wrong-type-argument benchmark-init/node 1] 5 (#$ . 1540)]) (byte-code "\300\301\302\303#\300\207" [function-put benchmark-init/node-name side-effect-free t] 4)#@81 compiler-macro for inlining `benchmark-init/node-type'. (fn CL-WHOLE-ARG CL-X) (defalias 'benchmark-init/node-type--cmacro #[514 "\300\301\302\303\211\211&\207" [cl--defsubst-expand (cl-x) (cl-block benchmark-init/node-type (progn (or (benchmark-init/node-p cl-x) (signal 'wrong-type-argument (list 'benchmark-init/node cl-x))) (aref cl-x 2))) nil] 9 (#$ . 1916)]) (byte-code "\300\301\302\303#\300\207" [define-symbol-prop benchmark-init/node-type compiler-macro benchmark-init/node-type--cmacro] 4)#@69 Access slot "type" of `benchmark-init/node' struct CL-X. (fn CL-X) (defalias 'benchmark-init/node-type #[257 "\301!>\204\302\303\304D\"\210\211\305H\207" [cl-struct-benchmark-init/node-tags type-of signal wrong-type-argument benchmark-init/node 2] 5 (#$ . 2426)]) (byte-code "\300\301\302\303#\300\207" [function-put benchmark-init/node-type side-effect-free t] 4)#@85 compiler-macro for inlining `benchmark-init/node-duration'. (fn CL-WHOLE-ARG CL-X) (defalias 'benchmark-init/node-duration--cmacro #[514 "\300\301\302\303\211\211&\207" [cl--defsubst-expand (cl-x) (cl-block benchmark-init/node-duration (progn (or (benchmark-init/node-p cl-x) (signal 'wrong-type-argument (list 'benchmark-init/node cl-x))) (aref cl-x 3))) nil] 9 (#$ . 2802)]) (byte-code "\300\301\302\303#\300\207" [define-symbol-prop benchmark-init/node-duration compiler-macro benchmark-init/node-duration--cmacro] 4)#@73 Access slot "duration" of `benchmark-init/node' struct CL-X. (fn CL-X) (defalias 'benchmark-init/node-duration #[257 "\301!>\204\302\303\304D\"\210\211\305H\207" [cl-struct-benchmark-init/node-tags type-of signal wrong-type-argument benchmark-init/node 3] 5 (#$ . 3332)]) (byte-code "\300\301\302\303#\300\207" [function-put benchmark-init/node-duration side-effect-free t] 4)#@85 compiler-macro for inlining `benchmark-init/node-children'. (fn CL-WHOLE-ARG CL-X) (defalias 'benchmark-init/node-children--cmacro #[514 "\300\301\302\303\211\211&\207" [cl--defsubst-expand (cl-x) (cl-block benchmark-init/node-children (progn (or (benchmark-init/node-p cl-x) (signal 'wrong-type-argument (list 'benchmark-init/node cl-x))) (aref cl-x 4))) nil] 9 (#$ . 3720)]) (byte-code "\300\301\302\303#\300\207" [define-symbol-prop benchmark-init/node-children compiler-macro benchmark-init/node-children--cmacro] 4)#@73 Access slot "children" of `benchmark-init/node' struct CL-X. (fn CL-X) (defalias 'benchmark-init/node-children #[257 "\301!>\204\302\303\304D\"\210\211\305H\207" [cl-struct-benchmark-init/node-tags type-of signal wrong-type-argument benchmark-init/node 4] 5 (#$ . 4250)]) (byte-code "\300\301\302\303#\304\305\306\"\207" [function-put benchmark-init/node-children side-effect-free t defalias copy-benchmark-init/node copy-sequence] 4)#@115 compiler-macro for inlining `make-benchmark-init/node'. (fn CL-WHOLE &cl-quote &key NAME TYPE DURATION CHILDREN) (defalias 'make-benchmark-init/node--cmacro #[385 "\300\301\"A@\300\302\"A@\300\303\"A@\300\304\"A@\211\203O\211@\305>\2037\211A\204/\306\307@\"\210\211AA\262\202\310>A@\203F\311\262\202\306\312@\"\210\202\210\313\314\315\311 \311    & \207" [plist-member :name :type :duration :children (:name :type :duration :children :allow-other-keys) error "Missing argument for %s" :allow-other-keys nil "Keyword argument %s not one of (:name :type :duration :children)" cl--defsubst-expand (name type duration children) (cl-block make-benchmark-init/node (record 'benchmark-init/node name type duration children))] 16 (#$ . 4697)]) (byte-code "\300\301\302\303#\300\207" [define-symbol-prop make-benchmark-init/node compiler-macro make-benchmark-init/node--cmacro] 4)#@95 Constructor for objects of type `benchmark-init/node'. (fn &key NAME TYPE DURATION CHILDREN) (defalias 'make-benchmark-init/node #[128 "\300\301\"A@\300\302\"A@\300\303\"A@\300\304\"A@\211\203O\211@\305>\2037\211A\204/\306\307@\"\210\211AA\262\202\310>A@\203F\311\262\202\306\312@\"\210\202\210\313\314%\207" [plist-member :name :type :duration :children (:name :type :duration :children :allow-other-keys) error "Missing argument for %s" :allow-other-keys nil "Keyword argument %s not one of (:name :type :duration :children)" record benchmark-init/node] 11 (#$ . 5601)]) (byte-code "\300\301\302\303#\304\305\306\307\310\311\312\313\305\303& \207" [function-put make-benchmark-init/node side-effect-free t cl-struct-define benchmark-init/node "Tree node structure.\n\nSlots:\n`name' Entry name.\n`type' Entry type, such as 'require or 'load.\n`duration' Duration in milliseconds.\n`children' Nodes loaded by this one." cl-structure-object record nil ((cl-tag-slot) (name) (type) (duration) (children)) cl-struct-benchmark-init/node-tags] 11)#@38 Recorded durations stored in a tree. (defvar benchmark-init/durations-tree (record 'benchmark-init/node 'benchmark-init/root nil 0 nil) (#$ . 6676))#@33 Current node in durations tree. (defvar benchmark-init/current-node benchmark-init/durations-tree (#$ . 6830))#@83 Calculate the number of milliseconds that have elapsed between B and A. (fn B A) (defalias 'benchmark-init/time-subtract-millis #[514 "\300\301\302\"!_\207" [1000.0 float-time time-subtract] 7 (#$ . 6946)])#@47 Flatten NODE into a property list. (fn NODE) (defalias 'benchmark-init/flatten #[257 "\301\302!>\204\303\304\305D\"\210\306HB\307\302!>\204$\303\304\305D\"\210\310HB\311\302!>\2049\303\304\305D\"\210\312HB\313\314!BF\302!>\204R\303\304\305D\"\210\315H\316\211\203m\211@\317\320!\"\262A\266\202\202X\262B\207" [cl-struct-benchmark-init/node-tags :name type-of signal wrong-type-argument benchmark-init/node 1 :type 2 :duration 3 :duration-adj benchmark-init/node-duration-adjusted 4 nil append benchmark-init/flatten] 10 (#$ . 7161)])#@51 True if NODE represents the tree root. (fn NODE) (defalias 'benchmark-init/node-root-p #[257 "=\207" [benchmark-init/durations-tree] 3 (#$ . 7734)])#@59 Duration of NODE with child durations removed. (fn NODE) (defalias 'benchmark-init/node-duration-adjusted #[257 "\301!>\204\302\303\304D\"\210\211\305H\306\301!>\204\"\302\303\304D\"\210\307H!\310!\203-\207Z\207" [cl-struct-benchmark-init/node-tags type-of signal wrong-type-argument benchmark-init/node 3 benchmark-init/sum-node-durations 4 benchmark-init/node-root-p] 7 (#$ . 7891)])#@48 Return the sum of NODES durations. (fn NODES) (defalias 'benchmark-init/sum-node-durations #[257 "\301\211\203%\211@\302!>\204\303\304\305D\"\210\211\306H\\\262A\266\202\202\207" [cl-struct-benchmark-init/node-tags 0 type-of signal wrong-type-argument benchmark-init/node 3] 8 (#$ . 8297)])#@47 Begin measuring NAME of TYPE. (fn NAME TYPE) (defalias 'benchmark-init/begin-measure #[514 "\301\302\303 \304%\211\207" [benchmark-init/current-node record benchmark-init/node current-time nil] 9 (#$ . 8607)])#@85 Stop measuring and store to PARENT if SHOULD-RECORD-P. (fn PARENT SHOULD-RECORD-P) (defalias 'benchmark-init/end-measure #[514 "\302\303 \304! >\204\305\306\307D\"\210\310H\" \203J\304! >\204+\305\306\307D\"\210\310I\210\304! >\204@\305\306\307D\"\210\311\311HBI\210\211\207" [benchmark-init/current-node cl-struct-benchmark-init/node-tags benchmark-init/time-subtract-millis current-time type-of signal wrong-type-argument benchmark-init/node 3 4] 9 (#$ . 8828)])#@108 Save duration spent in NAME of TYPE around INNER if SHOULD-RECORD-P. (fn NAME TYPE INNER SHOULD-RECORD-P) (defalias 'benchmark-init/measure-around '(macro . #[1028 "\300\301\302EDC\303\304\301EEE\207" [let parent benchmark-init/begin-measure prog1 benchmark-init/end-measure] 11 (#$ . 9323)])) (byte-code "\300\301\302\303\304$\210\305\301\304\"\210\300\306\307\303\304$\210\305\306\304\"\207" [ad-add-advice require (build-require-durations nil t (advice lambda (feature &optional filename noerror) "Record the time taken to require FEATURE." (let* ((name (symbol-name feature)) (already-loaded (memq feature features)) (should-record-p (lambda nil (and (not already-loaded) (memq feature features))))) (benchmark-init/measure-around name 'require ad-do-it should-record-p)))) around nil ad-activate load (build-load-durations nil t (advice lambda (file &optional noerror nomessage nosuffix must-suffix) "Record the time taken to load FILE." (let ((name (abbreviate-file-name file)) (should-record-p (lambda nil t))) (benchmark-init/measure-around name 'load ad-do-it should-record-p))))] 5)#@28 Deactivate benchmark-init. (defalias 'benchmark-init/deactivate #[0 "\300\301!\210\300\302!\207" [ad-deactivate require load] 2 (#$ . 10429) nil])#@52 Activate benchmark-init and start collecting data. (defalias 'benchmark-init/activate #[0 "\300\301!\210\300\302!\207" [ad-activate require load] 2 (#$ . 10581) nil]) (byte-code "\300\301\302\303#\210\304\301\302\305#\210\306\307!\207" [defalias benchmark-init/install benchmark-init/activate nil make-obsolete "2014-03-17" provide benchmark-init] 4) )))))))))))