Google Groups Home
Help | Sign in
Message from discussion formatter
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Daniel Weinreb  
View profile
 More options Dec 5 2007, 7:02 am
Newsgroups: comp.lang.lisp
From: Daniel Weinreb <d...@alum.mit.edu>
Date: Wed, 05 Dec 2007 12:02:59 GMT
Local: Wed, Dec 5 2007 7:02 am
Subject: Re: formatter

Steven M. Haflich wrote:
>> BUT. I can't remember if any CL implementation actually implements
>> a FORMAT compiler. Last I've looked, most just call FORMAT as usual.
>> FORMATTER is defined just in case some implementation
>> wants to provide that functionality.

> Allegro does, and apparently so does SBCL.

> As has been pointed out, it isn't necessary that formatter turn the
> format control string into "code", whatever that means, but only that a
> function be returned that is more efficient presumably by preprocessing
> the format control.

> In Allegro formatter returns a function, as required, but since the
> translation of a format control string into a function often produces
> a rather large function, the formatter function is a closure capturing
> an intermediate representation that achieves most of the speed
> optimization without incurring the huge code space overhead.

> The ANS doesn't point this out, but it should be obvious that calls to
> format with a constant format control string can have the work done by
> formatter performed by a compiler macro on format.  On the other hand,
> most programs contain lots of format control strings that are used only
> in rare conditions, so it is a little wasteful of space to transform
> unconditionally at compile time.  The behavior in Allegro under default
> optimization is to transform into a lazy conversion of the format
> control.  A format control string in a function is translated and
> cached by the function the first time it is used.

That makes a lot of sense. If I wanted to speed up format,
that's what I would do.

History/brag: I was the one who put "format" into Lisp.  It
was a direct ripoff of Multics's ioa_.  (This predates
Unix printf.)

> These optimizations were implemented perhaps 16 years ago, when memory
> was measured in MB rather than GB.  But instruction caches are still
> measured in MB...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google