GNU bug report logs - #28625
[PROPOSED] Speed up (format "%s" STRING) and the like

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Wed, 27 Sep 2017 18:53:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #26 received at 28625 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 28625 <at> debbugs.gnu.org
Subject: Re: bug#28625: [PROPOSED] Speed up (format "%s" STRING) and the like
Date: Fri, 29 Sep 2017 18:48:51 +0300
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> Date: Wed, 27 Sep 2017 11:52:12 -0700
> Cc: Paul Eggert <eggert <at> cs.ucla.edu>
> 
> Although the Lisp manual said that ‘format’ returns a
> newly-allocated string, this was not true for a few cases like
> (format "%s" ""), and fixing the documentation to allow reuse of
> arguments lets us improve performance in common cases like
> (format "foo") and (format "%s" "foo").
> * doc/lispref/strings.texi (Formatting Strings):
> * etc/NEWS:
> Say that the result of ‘format’ might not be newly allocated.
> * src/callint.c (Fcall_interactively):
> * src/dbusbind.c (XD_OBJECT_TO_STRING):
> * src/editfns.c (Fmessage, Fmessage_box):
> * src/xdisp.c (vadd_to_log, Ftrace_to_stderr):
> Just use Fformat or Fformat_message, as that’s simpler and no
> longer makes unnecessary copies.
> * src/editfns.c (styled_format): Remove last argument, as it
> is no longer needed: all callers now want it to behave as if it
> were true.  All remaining callers changed.  Make this function
> static again.  Simplify the function now that we no longer
> need to worry about whether the optimization is allowed.
> ---
>  doc/lispref/strings.texi | 10 +++++++---
>  etc/NEWS                 |  7 +++++++
>  src/callint.c            |  4 ++--
>  src/dbusbind.c           |  3 +--
>  src/editfns.c            | 26 ++++++++++----------------
>  src/lisp.h               |  1 -
>  src/xdisp.c              |  4 ++--
>  7 files changed, 29 insertions(+), 26 deletions(-)

Fine with me for the release branch.

Thanks.




This bug report was last modified 7 years and 283 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.