jsonfmt: Move arg parsing into XS
Going to need a way to pass arguments into the XS function anyway, so might as well do the entire arg parsing step in XS while we're at it. Provides a significant speedup for tiny inputs as well, but I don't find that too interesting.
This commit is contained in:
parent
e0161cd22c
commit
8ef2a724d1
6 changed files with 40 additions and 18 deletions
|
|
@ -6,12 +6,6 @@ use Exporter 'import';
|
|||
|
||||
our @EXPORT_OK = qw/json_format/;
|
||||
|
||||
|
||||
sub json_format($val, %opt) {
|
||||
my $r = FU::XS::json_format($val);
|
||||
# XXX: Does this go over the bytes? If so, not setting SvUTF8_on() in the first place would be much faster.
|
||||
utf8::encode($r) if $opt{utf8};
|
||||
$r
|
||||
}
|
||||
*json_format = *FU::XS::json_format;
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue