[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-devel] Temporarily bind gc-cons-threshold

From: Mosè Giordano
Subject: [AUCTeX-devel] Temporarily bind gc-cons-threshold
Date: Sat, 5 Mar 2016 00:44:03 +0100

Dear all,

I recently read this interesting post
which points out a trick for improving performance of functions
mentioned in the documentation of `gc-cons-threshold': temporarily
bind this variable to a high value.  In particular, the author of the
post suggests to bind it to `most-positive-fixnum', which can actually
be very large.  This strategy is also used in a few Emacs core
packages, one of the highest values I found is 10000000.  What about
doing the same in some places in AUCTeX?

One of the first time-consuming functions that came to my mind has
been `TeX-search-files-type-alist'.  Here are the result of a

--8<---------------cut here---------------start------------->8---
(benchmark-run 10
  (let ((TeX-search-files-type-alist LaTeX-search-files-type-alist))
    (TeX-search-files-by-type 'texinputs 'global t t)))
=>(5.607455037 30 0.9089236009999997)

(benchmark-run 10
  (let ((TeX-search-files-type-alist LaTeX-search-files-type-alist)
    (gc-cons-threshold 10000000))
    (TeX-search-files-by-type 'texinputs 'global t t)))
=>(4.924593101 10 0.32471203299999996)
--8<---------------cut here---------------end--------------->8---

This is an improvement of ~12%, definitely not dramatic but shaving
off a few hundredths of seconds from this function is a good
achievement anyway.

Comments?  Can you suggest other time-consuming functions that could
benefit from this trick?  I thought about `TeX-auto-parse', but in
most documents of mine it never triggers garbage collection.  Feel
free to report here if you experience significant improvements when
let-binding `gc-cons-threshold' in this function.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]