Skip to content

Instantly share code, notes, and snippets.

@npostavs
Created August 25, 2019 16:28
Show Gist options
  • Save npostavs/9801d57e4c182cb6463f26ad298518f0 to your computer and use it in GitHub Desktop.
Save npostavs/9801d57e4c182cb6463f26ad298518f0 to your computer and use it in GitHub Desktop.
;; https://old.reddit.com/r/emacs/comments/csut1x/weekly_tipstricketc_thread/ey1xzbf/?context=3
;; https://debbugs.gnu.org/25122#60
;; The following times obtained after evaluating the (mapc #'require
;; ...) form at the end.
(benchmark 1 '(pp-to-string load-history))
"Elapsed time: 6.311048s (1.167418s in 7 GCs)"
(benchmark 1 '(prin1-to-string load-history))
"Elapsed time: 0.349902s (0.153847s in 1 GCs)"
(with-temp-buffer
(prin1 load-history (current-buffer))
(benchmark 1 '(pp-buffer)))
"Elapsed time: 4.475286s (0.974722s in 6 GCs)"
(benchmark 1 '(cl-prin1-to-string load-history))
"Elapsed time: 5.312695s (0.858355s in 5 GCs)"
(benchmark 1 '(let ((print-quoted t)
(print-circle t))
(cl-prin1-to-string load-history)))
"Elapsed time: 22.966040s (18.792864s in 105 GCs)"
(benchmark 1 '(let ((print-quoted t))
(cl-prin1-to-string load-history)))
"Elapsed time: 5.587888s (1.037248s in 6 GCs)"
(benchmark 1 '(let ((print-circle t))
(cl-prin1-to-string load-history)))
"Elapsed time: 23.128472s (18.931141s in 105 GCs)"
;; `describe-variable' is approximately `pp-buffer' +
;; `cl-prin1-to-string' (with print-circle set).
(benchmark 1 '(describe-variable 'load-history))
"Elapsed time: 28.911928s (19.910822s in 111 GCs)"
;; Setting `cl-print-readably' makes `cl-print' fallback to `prin1'.
(benchmark 1 '(let ((cl-print-readably t))
(describe-variable 'load-history)))
"Elapsed time: 5.931851s (1.027511s in 6 GCs)"
(mapc #'require
'(calc-sel calc-fin calc-embed
calc-misc calc-incom calc-comb calc-keypd calc-poly
calc-rewr calc-nlfit calc-arith calc-mode calc-alg
calc-menu calc-graph calc-store calc-yank calcalg3
calc-prog calc-vec calc-mtx calc-funcs calc-units
calc-frac calc-trail calc-stat calc-math calc-rules
calc-cplx calcsel2 calcalg2 calc-undo calc-bin
calc-forms calc-map calccomp calc-aent calc-lang
calc-stuff calc-help calc-ext appt holidays
hol-loaddefs todo-mode timeclock cal-html cal-iso
cal-china lunar solar cal-dst cal-islam
cal-hebrew cal-tex cal-bahai cal-x cedet-cscope
cedet-idutils data-debug pulse ede/speedbar ede/files
ede ede/detect ede/base ede/auto ede/source
eieio-speedbar inversion cedet-global srecode cl-indent
cursor-sensor ert-x chart check-declare shadow
checkdoc tq testcover generic avl-tree
thunk disass rx elint elp
copyright ert eieio-custom autoload edebug
re-builder helper package-x trace let-alist
inline edt keypad cua-gmrk cua-rect
cua-base viper viper-ex viper-macs viper-mous
viper-cmd viper-keym viper-util viper-init erc-xdcc
erc-capab erc-truncate erc-page erc-spelling erc-sound
erc-desktop-notifications erc-ibuffer erc-replace erc-ezbounce erc-autoaway
erc-speedbar erc-notify erc-services erc-log erc-identd
erc-dcc em-glob em-alias em-dirs em-ls
em-prompt em-smart em-cmpl em-rebind em-term
em-unix em-banner em-xtra em-script em-hist
em-pred em-basic gnus-dired sieve plstore
gnus-delay rfc1843 smiley gnus-bookmark gnus-sieve
gnus-notifications gnus-html nndoc nnbabyl nneething
spam gnus-uu gnus-kill nnir sieve-mode
deuglify flow-fill gnus-dup ecomplete gnus-async
gssapi gnus-salt canlock nnmbox gnus-draft
nnfolder yenc nnnil nnagent gnus-agent
gnus-picon gnus-diary nndiary gnus-cache gnus-registry
nnvirtual nndir nnweb gnus-srvr gnus-score
score-mode nnspool pop3 gnus-eform sieve-manage
gnus-icalendar icalendar diary-lib diary-loaddefs nndraft
nnmh gnus-demon spam-report gnus-msg
gnus-topic nnrss nnmairix nnml nngateway
gnus-fun nnmaildir gnus-gravatar gravatar registry
eieio-compat eieio-base spam-stat latin1-disp latexenc
iso-ascii utf-7 ccl mule-diag kkc
ja-dic-utl ogonek lao-util korea-util viet-util
tibet-util ethio-util robin thai-util thai-word
japan-util china-util cyril-util quail supercite
regi mail-extr uce rmailsort feedmail
mailalias rmail-spam-filter rmailsum mspools mail-hist
smtpmail footnote binhex emacsbug unrmail
metamail rfc2368 mailclient undigest hashcash
uudecode rmailmm rmailedit rmailout rmail
sendmail crm gnus-cite gnus-art mm-uu mml2015
mm-view mml-smime smime gnus-sum eww mm-url
soap-client warnings rng-xsd xsd-regexp sasl-ntlm
newsticker tramp-gvfs ntlm sasl-cram tramp-smb
tramp-adb misc scroll-lock kermit makesum
dns socks quickurl eudc mairix
tramp-cache zeroconf telnet newst-treeview eudc-vars
shr-color snmp-mode sasl-scram-rfc sasl-scram-sha-1 shr
imap rfc2104 rcirc hmac-def dig
sasl-digest hmac-md5 net-utils newst-plainview newst-reader
newst-ticker newst-backend webjump sasl sasl-anonymous
sasl-login sasl-plain rlogin network-stream nsm
starttls goto-addr rng-nxml nxml-mode rng-valid
nxml-outln nxml-rap org-clock org-gnus org-colview
org-attach org-ctags ob-latex org-eshell org-id
org-timer ox-beamer org-w3m ox-man org-inlinetask
ox-texinfo org-docview ob-gnuplot ob-lisp org-archive
ob-plantuml org-bbdb org-table ox-md org-info
ob-ocaml ox-org ob-picolisp ob-js org-habit
ox-odt rng-loc rng-uri rng-parse rng-match
rng-dt rng-util rng-pttrn nxml-parse nxml-ns
nxml-enc xmltok nxml-util ob-maxima org-mobile
org-agenda org-protocol org-bibtex org-irc ob-R
org-crypt ox-latex ox-icalendar ox-html ox-ascii
ox-publish ox org-element org-datetree org-mhe
org-capture org-mouse org-feed org-rmail ob-ditaa
ob-ruby ob-python org-indent bubbles gametree
dunnet blackbox morse decipher hanoi
studly doctor dissociate tetris spook
handwrite solitaire pong 5x5 animate
zone life mpuz snake gamegrid
gomoku fortune cookie1 perl-mode ld-script
mixal-mode ps-mode modula2 python tramp-sh
gdb-mi bindat cwarn m4-mode bug-reference
hideif hideshow gud autoconf autoconf-mode
sql asm-mode ada-xref mantemp ebnf2ps
flymake ada-mode which-func meta-mode cfengine
cfengine3 sh-script idlw-shell idlwave idlwave-help
idlw-help verilog-mode cpp pascal f90
tcl vera-mode make-mode bat-mode inf-lisp
dcl-mode xscheme glasses vhdl-mode simula
opascal ebrowse etags xref project
icon fortran cperl-mode prolog cc-awk
ruby-mode cc-langs subword antlr-mode octave
js cmacexp cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs refill reftex-ref refer
reftex-global reftex-toc nroff-mode enriched flyspell
refbib po reftex-dcr reftex-auc reftex-index
bibtex tildify css-mode smie two-column
reftex-cite bibtex-style tex-mode reftex-sel remember
rst dns-mode underline makeinfo bib-mode
texinfmt texnfo-upd texinfo artist picture
reporter table ispell page-ext reftex-parse
reftex reftex-vars conf-mode sgml-mode url-queue
url-tramp tramp tramp-compat tramp-loaddefs trampver
ucs-normalize url-handlers url-http url-auth url-cache
url-gw url-news nntp gnus-group gnus-undo
gnus-start gnus-cloud nnimap nnmail mail-source
tls gnutls utf7 netrc parse-time
gnus-spec gnus-int gnus-range gnus-win nnoo
url-ldap ldap url-mailto url-nfs url-file
url-dired url-irc vc-bzr vc-sccs pcvs
log-view ediff-ptch vc-src vc-cvs vc-mtn
smerge-mode emerge vc-git cvs-status compare-w
ediff pcvs-defs vc-rcs diff ediff-merg
ediff-mult ediff-util ediff-diff ediff-wind ediff-help
ediff-init vc-annotate vc-hg log-edit message
rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums gmm-utils mailheader vc-dir ewoc
add-log diff-mode pcvs-parse pcvs-info pcvs-util
ediff-vers vc-svn icomplete filesets
vcursor wid-browse tempo pcmpl-gnu executable
pcmpl-cvs expand t-mouse avoid pcmpl-rpm
url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap
profiler pcmpl-unix recentf midnight whitespace
strokes misearch multi-isearch ruler-mode timezone
server ls-lisp reposition notifications dbus
xml cdl ses unsafep pcmpl-x
macros mailabbrev cl generic-x obarray
minibuf-eldef dos-w32 ebuff-menu help-at-pt dos-fns
ps-bdf ps-mule reveal
find-lisp echistory talk emacs-lock dom
informat hl-line tmm image-dired iimage
winner chistory tar-mode elec-pair filecache
char-fold thumbs ffap url-parse url-vars
hexl proced msb delim-col calc
calc-loaddefs calc-macs apropos repeat w32-vars
windmove gnus nnheader mail-utils doc-view
subr-x vt100-led delsel array dos-vars
epa-file epa derived epg shadowfile
ange-ftp scroll-all autoarg dired-x mouse-copy
advice saveplace face-remap ido desktop
frameset skeleton locate autorevert filenotify
tree-widget cus-theme linum flow-ctrl image-file
hex-util arc-mode archive-mode ibuf-ext autoinsert
mb-depth elide-head imenu mouse-drag dirtrack
calculator hippie-exp edmacro kmacro cmuscheme
scheme vt-control xt-mouse wdired esh-var
esh-io esh-cmd esh-opt esh-ext esh-proc
esh-arg esh-groups eshell esh-module esh-mode
esh-util time-stamp novice soundex paren
hilit-chg type-break finder finder-inf lisp-mnt
package epg-config xwidget browse-url ibuffer
forms forms-mode double rect tutorial
vc vc-dispatcher info-xref erc-list erc-menu
erc-join erc-ring erc-networks erc-pcomplete erc-track
erc-match erc-button erc-fill erc-stamp erc-netsplit
erc-goodies erc erc-backend erc-compat auth-source
cl-seq gnus-util mm-util mail-prsvr password-cache
info-look allout-widgets allout foldout help-macro
printing ps-print ps-def lpr find-file
descr-text htmlfontify cus-edit cus-start cus-load
wid-edit image-mode dired-aux tabify jka-compr
info speedbar sb-image ezimage dframe
shell md4 completion battery bs
find-dired dired json map seq
master view dabbrev debug rot13
follow bookmark color time ielm
hi-lock woman man term disp-table
ehelp savehist align sort mpc
loadhist find-cmd grep compile semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw
eieio byte-opt bytecomp byte-compile cconv
eieio-core cl-macs gv mode-local cedet
org org-macro org-footnote org-pcomplete pcomplete
org-list org-faces org-entities noutline outline
easy-mmode org-version ob-emacs-lisp ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-src
ob-keys ob-comint comint ansi-color ring
ob-core ob-eval org-compat org-macs org-loaddefs
format-spec find-func cal-menu calendar cal-loaddefs
cl-extra thingatpt help-fns benchmark help-mode
easymenu cl-loaddefs pcase cl-lib pp
time-date mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel
x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list
newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese
eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian
cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay
sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable
backquote inotify dynamic-setting font-render-setting x-toolkit
x multi-tty make-network-process emacs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment