[Top][All Lists]

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

Speeding up (format "%s" STRING)

From: Paul Eggert
Subject: Speeding up (format "%s" STRING)
Date: Wed, 27 Sep 2017 13:13:51 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

In Bug#28625 I propose changing the documentation for the 'format' function so that it no longer states that 'format' returns a newly-allocated string. This statement is already incorrect for cases like (format "%s" ""), and removing the statement lets us improve the performance for other cases such as (format "foo") and (format "%s" "foo"). Although I doubt whether any code depends on 'format' always returning a newly-allocated string for these cases, the proposed patch does change the semantics of 'format' slightly, so I'm sending this heads-up to emacs-devel to ask if anyone sees problems with it.

As noted in Bug#28625, on my old desktop (AMD Phenom II X4 910e), the proposed patch speeds up (format "%s" "Hello, world!") by a factor of about 9. It also causes Emacs to use less RAM (harder to measure) and simplifies the Emacs source code.

reply via email to

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