The pp package is great for pretty-printing Emacs Lisp forms, but can be excruciatingly slow for "large" forms.

Is there a general rule-of-thumb for determining whether we should pp a form or not? E.g. if a sequence contains more than X elements, pp would probably be unbearably slow?

I'm not sure what causes the poor performance of pp for "large" forms; that is, I'm not sure what a good definition of "large" is. Is it length? Depth? Some combination of both? What dominates pp time?

  • Define "too slow". It all depends on what you want/need, and that changes from person to person and context to context. Primarily opinion-based. – Drew Oct 8 '16 at 22:29
  • "Too slow" as in "this will make the cursor change into an hourglass" or "most users will find it annoying". For context, I'm doing some work on describe-variable, and it's clearly not feasible to pp every value. – Tianxiang Xiong Oct 8 '16 at 22:39
  • Still too vague and user-dependent, not to mention platform-dependent. – Drew Oct 8 '16 at 22:46
  • FWIW, I use pp (well, pp+.el, but that doesn't change much here), and I don't hesitate to use it on structures that (at least I feel) are large. And my describe-variable does pretty-print. Is load-history or font-lock-keywords something that you find too big to pretty-print? – Drew Oct 8 '16 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.