[Top][All Lists]

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

Re: list-print-separator

From: Stefan Monnier
Subject: Re: list-print-separator
Date: Mon, 25 Apr 2011 09:41:39 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

TZ> Since hashtables can get pretty big, it would be nice to have a
TZ> separator between entries when they are printed.  Could that be provided
TZ> at the top level, e.g.

TZ> (let ((hash-table-print-separator "\\\n"))
TZ> (format "%S" my-hash-table))

SM> How 'bout changing `pp' instead?

> I tried that (thanks for the pointer, I didn't know about it) and it was
> MUCH slower than my patch.

> Tested against a hashtable with 40K elements.  My patch through `format'
> took less than 3 seconds on a modern CPU with enough memory.  `pp' took
> a minute before I interrupted it.

Hmm... I wouldn't try to compare the speed of `print' with that of `pp'
since they do very different amounts of work and are implemented in
languages whose performance is very different, but there's clearly room
for improvement in pp's speed.

> I intend to use it for large objects so the performance worries me.

You could use an ad-hoc pp-like function, maybe?  The way I see it, you
typically either need "fast" or "pretty" but very rarely both.


reply via email to

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