unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Ted Zlatanov <tzz@lifelogs.com>
Cc: emacs-devel@gnu.org
Subject: Re: list-print-separator
Date: Mon, 25 Apr 2011 09:41:39 -0300	[thread overview]
Message-ID: <jwvr58q33rh.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87hb9nglen.fsf@lifelogs.com> (Ted Zlatanov's message of "Sun, 24 Apr 2011 20:38:40 -0500")

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.


        Stefan



  reply	other threads:[~2011-04-25 12:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-06 10:59 entry separator for printing hashtables Ted Zlatanov
2011-04-21 23:17 ` list-print-separator (was: entry separator for printing hashtables) Ted Zlatanov
2011-04-24  4:47   ` list-print-separator Stefan Monnier
2011-04-25  1:38     ` list-print-separator Ted Zlatanov
2011-04-25 12:41       ` Stefan Monnier [this message]
2011-04-25 12:54         ` list-print-separator Ted Zlatanov
2011-04-25 14:51           ` list-print-separator Stefan Monnier
2011-04-25 15:01             ` list-print-separator Ted Zlatanov
2011-04-25 15:37               ` list-print-separator Stefan Monnier
2011-04-25 15:59                 ` list-print-separator Ted Zlatanov
2011-04-25 16:55                   ` list-print-separator Thierry Volpiatto
2011-04-25 17:28                     ` list-print-separator Stefan Monnier
2011-04-25 17:55                       ` list-print-separator Eli Zaretskii
2011-04-25 18:35                         ` list-print-separator Stefan Monnier
2011-04-25 21:05             ` list-print-separator Andy Moreton
2011-04-25 22:45               ` list-print-separator Ted Zlatanov
2011-04-26 12:52                 ` list-print-separator Andy Moreton
2011-04-26 12:55                 ` list-print-separator Stefan Monnier
2011-04-26 15:23                   ` list-print-separator Ted Zlatanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvr58q33rh.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=tzz@lifelogs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).