Optimize high_prec_dec__round_just_enough

name                                                               old time/op  new time/op  delta
wuffs_strconv_render_number_f64_just_enough_fractions/clang5       56.4µs ± 1%  56.3µs ± 1%     ~     (p=1.000 n=5+5)
wuffs_strconv_render_number_f64_just_enough_small_integers/clang5  4.12µs ± 2%  1.00µs ± 1%  -75.65%  (p=0.008 n=5+5)
wuffs_strconv_render_number_f64_just_enough_fractions/gcc7         54.3µs ± 0%  54.2µs ± 0%     ~     (p=0.151 n=5+5)
wuffs_strconv_render_number_f64_just_enough_small_integers/gcc7    4.16µs ± 0%  1.01µs ± 0%  -75.77%  (p=0.000 n=4+5)
This commit is contained in:
Nigel Tao committed 2020-07-03 23:44:37 +10:00
1 parent 58678cb342
commit 19b3ce24a3
5 files changed
+35 -11

No files matched your search

+3 -2
View File
@@ -9673,8 +9673,9 @@ wuffs_base__private_implementation__high_prec_dec__round_just_enough(
// Let f be the floating point number represented by exp2 and mantissa (and
// also the number in h): the number (mantissa * (2 ** (exp2 - 52))).
//
// If f is zero, we can return early.
if (mantissa == 0) {
// If f is zero or a small integer, we can return early.
if ((mantissa == 0) ||
((exp2 < 53) && (h->decimal_point >= ((int32_t)(h->num_digits))))) {
return;
}