fu/FU/Benchmarks.pod
Yorhel 1a0fb03205 jsonfmt: Add canonical option
Not as bad as I had expected it to be; managed to keep the
implementation a little bit simpler and cleaner than JSON::XS.
2025-01-29 18:46:27 +01:00

172 lines
4.9 KiB
Text

=head1 NAME
FU::Benchmarks - A bunch of automated benchmark results.
=head1 DESCRIPTION
This file is automatically generated from 'bench.PL' in the L<FU> distribution.
These benchmarks compare performance of some FU functionality against similar
modules found on CPAN.
B<DISCLAIMER#1:> Obtaining accurate measurements is notoriously hard. Take the
numbers below with a few buckets of salt, any difference below 10% is most
likely noise.
B<DISCLAIMER#2:> Goodhart's law: "When a measure becomes a target, it ceases to
be a good measure". I've used these benchmarks to find and optimize hotspots in
FU, which in turn means these numbers may look better than they are in
real-world use.
=head1 MODULE VERSIONS
The following module versions were used:
=over
=item L<Cpanel::JSON::XS> 4.38
=item L<FU> 0.1
=item L<JSON::PP> 4.16
=item L<JSON::SIMD> 1.06
=item L<JSON::XS> 4.03
=back
=head1 BENCHMARKS
=head2 JSON Formatting
These benchmarks run on large-ish arrays with repeated values. JSON encoding is
sufficiently fast that Perl function calling overhead tends to dominate for
smaller inputs, but I don't find that overhead very interesting.
Also worth noting that JSON::SIMD formatting code is forked from JSON::XS, the
SIMD parts are only used for parsing.
API object from L<JSON::XS> documentation.
JSON::PP 5342/s
Cpanel::JSON::XS 110660/s
JSON::SIMD 128161/s
JSON::XS 130434/s
FU::Util 129117/s
Small integers
JSON::PP 117/s
Cpanel::JSON::XS 7370/s
JSON::SIMD 8191/s
JSON::XS 8143/s
FU::Util 9188/s
Large integers
JSON::PP 2208/s
Cpanel::JSON::XS 29299/s
JSON::SIMD 37344/s
JSON::XS 35873/s
FU::Util 114084/s
ASCII strings
JSON::PP 2798/s
Cpanel::JSON::XS 116754/s
JSON::SIMD 134130/s
JSON::XS 133137/s
FU::Util 166142/s
Unicode strings
JSON::PP 5067/s
Cpanel::JSON::XS 95453/s
JSON::SIMD 107955/s
JSON::XS 105367/s
FU::Util 103071/s
String escaping (few)
JSON::PP 4275/s
Cpanel::JSON::XS 138030/s
JSON::SIMD 157735/s
JSON::XS 159066/s
FU::Util 171426/s
String escaping (many)
JSON::PP 2231/s
Cpanel::JSON::XS 140657/s
JSON::SIMD 154850/s
JSON::XS 154280/s
FU::Util 132514/s
Canonical hash key ordering (small)
JSON::PP 835/s
Cpanel::JSON::XS 28155/s
JSON::SIMD 30066/s
JSON::XS 32151/s
FU::Util 27079/s
Canonical hash key ordering (large)
JSON::PP 756/s
Cpanel::JSON::XS 10710/s
JSON::SIMD 12640/s
JSON::XS 12858/s
FU::Util 12819/s
=cut
# Cached data used by bench.PL.
jsonfmt/api Cpanel::JSON::XS Cpanel::JSON::XS 4.38 110660
jsonfmt/api FU::Util FU 0.1 129117
jsonfmt/api JSON::PP JSON::PP 4.16 5342
jsonfmt/api JSON::SIMD JSON::SIMD 1.06 128161
jsonfmt/api JSON::XS JSON::XS 4.03 130434
jsonfmt/canonl Cpanel::JSON::XS Cpanel::JSON::XS 4.38 10710
jsonfmt/canonl FU::Util FU 0.1 12819
jsonfmt/canonl JSON::PP JSON::PP 4.16 756
jsonfmt/canonl JSON::SIMD JSON::SIMD 1.06 12640
jsonfmt/canonl JSON::XS JSON::XS 4.03 12858
jsonfmt/canons Cpanel::JSON::XS Cpanel::JSON::XS 4.38 28155
jsonfmt/canons FU::Util FU 0.1 27079
jsonfmt/canons JSON::PP JSON::PP 4.16 835
jsonfmt/canons JSON::SIMD JSON::SIMD 1.06 30066
jsonfmt/canons JSON::XS JSON::XS 4.03 32151
jsonfmt/intl Cpanel::JSON::XS Cpanel::JSON::XS 4.38 29299
jsonfmt/intl FU::Util FU 0.1 114084
jsonfmt/intl JSON::PP JSON::PP 4.16 2208
jsonfmt/intl JSON::SIMD JSON::SIMD 1.06 37344
jsonfmt/intl JSON::XS JSON::XS 4.03 35873
jsonfmt/ints Cpanel::JSON::XS Cpanel::JSON::XS 4.38 7370
jsonfmt/ints FU::Util FU 0.1 9188
jsonfmt/ints JSON::PP JSON::PP 4.16 117
jsonfmt/ints JSON::SIMD JSON::SIMD 1.06 8191
jsonfmt/ints JSON::XS JSON::XS 4.03 8143
jsonfmt/strel Cpanel::JSON::XS Cpanel::JSON::XS 4.38 140657
jsonfmt/strel FU::Util FU 0.1 132514
jsonfmt/strel JSON::PP JSON::PP 4.16 2231
jsonfmt/strel JSON::SIMD JSON::SIMD 1.06 154850
jsonfmt/strel JSON::XS JSON::XS 4.03 154280
jsonfmt/stres Cpanel::JSON::XS Cpanel::JSON::XS 4.38 138030
jsonfmt/stres FU::Util FU 0.1 171426
jsonfmt/stres JSON::PP JSON::PP 4.16 4275
jsonfmt/stres JSON::SIMD JSON::SIMD 1.06 157735
jsonfmt/stres JSON::XS JSON::XS 4.03 159066
jsonfmt/strs Cpanel::JSON::XS Cpanel::JSON::XS 4.38 116754
jsonfmt/strs FU::Util FU 0.1 166142
jsonfmt/strs JSON::PP JSON::PP 4.16 2798
jsonfmt/strs JSON::SIMD JSON::SIMD 1.06 134130
jsonfmt/strs JSON::XS JSON::XS 4.03 133137
jsonfmt/stru Cpanel::JSON::XS Cpanel::JSON::XS 4.38 95453
jsonfmt/stru FU::Util FU 0.1 103071
jsonfmt/stru JSON::PP JSON::PP 4.16 5067
jsonfmt/stru JSON::SIMD JSON::SIMD 1.06 107955
jsonfmt/stru JSON::XS JSON::XS 4.03 105367