emacs-devel
[Top][All Lists]
Advanced

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

Re: RFC: String interpolation


From: Clément Pit--Claudel
Subject: Re: RFC: String interpolation
Date: Sat, 10 Dec 2016 11:01:25 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

On 2016-12-08 16:31, Stefan Monnier wrote:
> Indeed.  But the Elisp interpreter is slow compared to the `format`
> parser, so I'd expect the use of a single `format` call to be more
> efficient (both in code size and execution time).  That's just a gut
> feeling, tho, I have no hard data to back it up (my implementation uses
> a single `format` call partly because of that gut feeling but also
> because it seemed easier).

Indeed, format seems to be a bit faster:

(benchmark-run-compiled 50000 (let ((a 1) (b 2))
                                (fmt "What's $a + $b? About $(+ a b).")))
=> (1.4476880189999999 2 0.11585387999999952)

(benchmark-run-compiled 50000 (let ((a 1) (b 2))
                                (format "What's %s + %s? About %s." a b (+ a 
b))))
=> (1.332636799 1 0.057698191000000065)

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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