lmi
[Top][All Lists]
Advanced

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

Re: [lmi] [lmi-commits] master e8d4b982 08/11: Measure ledger_format() s


From: Vadim Zeitlin
Subject: Re: [lmi] [lmi-commits] master e8d4b982 08/11: Measure ledger_format() speed
Date: Sat, 30 Apr 2022 16:54:29 +0200

On Fri, 29 Apr 2022 11:59:33 -0400 (EDT) Greg Chicares 
<gchicares@sbcglobal.net> wrote:

GC> branch: master
GC> commit e8d4b982b276914f8df11963c26d8d2cc89f35ca
GC> Author: Gregory W. Chicares <gchicares@sbcglobal.net>
GC> Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
GC> 
GC>     Measure ledger_format() speed

 I'd be curious (but not curious enough to do it without you telling me
that it would be useful) to benchmark it with C++20 format library. It has
support for using separators, see https://fmt.dev/latest/api.html#locale
(this is a link to fmt documentation just because it has a nice example,
but the standard library works in the same way, at least in the recent
enough implementations to include it) and AFAIK it's much faster than
snprintf(), let alone C++ stream insertion operators that were designed to
be as slow as possible.

 Of course, the real reason I keep brining fmt up is that it's so much more
convenient to use (and not just faster and safer) -- once you get used to
using it, going back to C++ streams is just horrible. And while I don't
think we can rely on std::format() being available in MinGW version that we
use, using standalone fmt is trivial (it's header-only) and we could start
using it right now and switch to the standard library without changing
anything in the code when it becomes available there.

 Regards,
VZ

Attachment: pgpLh_vBf5_7G.pgp
Description: PGP signature


reply via email to

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