This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_sv_vcatpvfn_flags: remove "%.Ng" special-case
authorDavid Mitchell <davem@iabyn.com>
Sat, 20 May 2017 11:07:23 +0000 (12:07 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 7 Jun 2017 08:11:03 +0000 (09:11 +0100)
commit27b6e3b1f92b0d1cef7c9597770147628d7240bf
treee4d6565f74d1384ddb81d939c85fe07dd112da3e
parentf9e6989e75204d4bb17f8bd9f218f30ec363c14d
Perl_sv_vcatpvfn_flags: remove "%.Ng" special-case

This function has special-case handling for the formats "%.0f" and
"%.NNg", to speed things up. This special-casing appears twice,
once near the top of the function for where the format matches exactly
"%.0f" or "%.Ng" (N is 1..99), and once again in the main loop of the
function, where it handles those format elements embedded in the larger
format: "....%.0f..." and "....%.Ng..." (N > 0).

The problem with the "%.Ng" code is that it isn't as robust as the more
general "....%.Ng..." code - in particular the latter checks for a
locale-dependent radix-point when determining needed buffer size.

This commit removes the "%.Ng" special-cased code but leaves the
"....%.Ng..." special-cased code. It makes the former about 7% slower
compared to the situation at the start of this branch. (Part of the effort
in this branch has been to make the "....%.Ng..." code faster, so that
there's less of an overall performance hit by removing "%.Ng").
sv.c