Emacs Lisp Processing 5 Thousand Files: “find-file” vs “with-temp-buffer”

Using find-file to open 5565 files, with font-lock-mode off, backup off etc, takes 10 min plus 8 min garbage collection. Total wall clock time is 18 minutes.

Using with-temp-buffer, 22 seconds.

Moral: when doing batch text processing of thousands of files, don't use find-file, use with-temp-buffer or with-temp-file instead. (use the latter when you need to make changes to the file.)

2011-12-21 Addendum: now fully detailed at http://xahlee.org/emacs/elisp_find-file_vs_with-temp-buffer.html

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs