tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit b1a127786c057081775dc93b84a4e3c3287d1fc5
parent 2bdceec98eae4d5c11c4f376590bfd3b9541da44
Author: Mike Hommey <mh+mozilla@glandium.org>
Date:   Wed,  1 Oct 2025 23:47:49 +0000

Bug 1989921 - Restore previous mozToString code when using libc++. r=nika

It looks like std::to_string is slower than the older code using
ostringstream when building with libc++ (at least on mac). Replacing
this with uses of mozilla::PrintfTarget::appendIntDec didn't yield
a better outcome, so, at least for now, just rely on the old code when
building against libc++.

Differential Revision: https://phabricator.services.mozilla.com/D266759

Diffstat:
Mmozglue/misc/decimal/moz-decimal-utils.h | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/mozglue/misc/decimal/moz-decimal-utils.h b/mozglue/misc/decimal/moz-decimal-utils.h @@ -70,11 +70,23 @@ String mozToString(double aNum) { } String mozToString(int64_t aNum) { +#ifdef _LIBCPP_VERSION + std::ostringstream o; + o << std::setprecision(std::numeric_limits<int64_t>::digits10) << aNum; + return o.str(); +#else return std::to_string(aNum); +#endif } String mozToString(uint64_t aNum) { +#ifdef _LIBCPP_VERSION + std::ostringstream o; + o << std::setprecision(std::numeric_limits<uint64_t>::digits10) << aNum; + return o.str(); +#else return std::to_string(aNum); +#endif } namespace moz_decimal_utils {