NAME
FU::Benchmarks - A bunch of automated benchmark results.
DESCRIPTION
This file is automatically generated from 'bench.PL' in the FU distribution. These benchmarks compare performance of some FU functionality against similar modules found on CPAN.
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.
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.
DISCLAIMER#3: Many of these benchmarks exists solely to test edge case performance, these numbers are not representative for real-world use.
MODULE VERSIONS
The following module versions were used:
- Cpanel::JSON::XS 4.40
- DBD::Pg 3.18.0
- FU 1.4
- HTML::Tiny 1.08
- JSON::PP 4.16
- JSON::SIMD 1.07
- JSON::Tiny 0.58
- JSON::XS 4.04
- Pg::PQ 0.15
- TUWF::XML 1.6
- XML::Writer 0.900
BENCHMARKS
JSON Parsing & 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 JSON::XS documentation.
Encode Canonical Decode
JSON::PP 5136/s 4943/s 1240/s
JSON::Tiny 7617/s - 3474/s
Cpanel::JSON::XS 108128/s 98734/s 105811/s
JSON::SIMD 125105/s 114822/s 118410/s
JSON::XS 128749/s 117518/s 120190/s
FU::Util 126909/s 109166/s 113983/s
Object (small)
Encode Canonical Decode
JSON::PP 896/s 826/s 194/s
JSON::Tiny 1216/s - 519/s
Cpanel::JSON::XS 44184/s 28190/s 19449/s
JSON::SIMD 52633/s 31157/s 23587/s
JSON::XS 50314/s 34276/s 25294/s
FU::Util 42121/s 25618/s 19203/s
Object (large)
Encode Canonical Decode
JSON::PP 910/s 734/s 98/s
JSON::Tiny 1068/s - 404/s
Cpanel::JSON::XS 27626/s 12484/s 15333/s
JSON::SIMD 34106/s 12808/s 23674/s
JSON::XS 35738/s 13099/s 22637/s
FU::Util 37663/s 13366/s 16292/s
Object (large, mixed unicode)
Encode Canonical Decode
JSON::PP 835/s 664/s 82/s
JSON::Tiny 1028/s - 427/s
Cpanel::JSON::XS 24123/s 1352/s 8694/s
JSON::SIMD 26008/s 1413/s 19707/s
JSON::XS 25444/s 1391/s 10442/s
FU::Util 33132/s 12006/s 11861/s
Small integers
Encode Decode
JSON::PP 116/s 30/s
JSON::Tiny 158/s 86/s
Cpanel::JSON::XS 7426/s 5774/s
JSON::SIMD 8294/s 4375/s
JSON::XS 8526/s 6179/s
FU::Util 7996/s 5962/s
Large integers
Encode Decode
JSON::PP 2213/s 341/s
JSON::Tiny 2910/s 1661/s
Cpanel::JSON::XS 32616/s 53053/s
JSON::SIMD 37749/s 53032/s
JSON::XS 38644/s 55004/s
FU::Util 109930/s 63358/s
ASCII strings
Encode Decode
JSON::PP 2811/s 312/s
JSON::Tiny 3924/s 1506/s
Cpanel::JSON::XS 129468/s 51536/s
JSON::SIMD 140393/s 64499/s
JSON::XS 141149/s 56913/s
FU::Util 165938/s 55034/s
Unicode strings
Encode Decode
JSON::PP 5138/s 248/s
JSON::Tiny 6501/s 2677/s
Cpanel::JSON::XS 91004/s 64101/s
JSON::SIMD 101185/s 80941/s
JSON::XS 106312/s 61104/s
FU::Util 205716/s 52041/s
String escaping (few)
Encode Decode
JSON::PP 4269/s 329/s
JSON::Tiny 4878/s 2101/s
Cpanel::JSON::XS 152958/s 105597/s
JSON::SIMD 165340/s 130074/s
JSON::XS 165863/s 87872/s
FU::Util 228511/s 81599/s
String escaping (many)
Encode Decode
JSON::PP 4052/s 573/s
JSON::Tiny 4575/s 2274/s
Cpanel::JSON::XS 201958/s 102800/s
JSON::SIMD 242806/s 146341/s
JSON::XS 209689/s 98420/s
FU::Util 210713/s 100255/s
XML Writing
FU::XMLWriter is the only XS-based XML DSL that I'm aware of, so all direct competition is inherently slower by virtue of being pure perl. I'm sure some templating modules will perform better, though.
HTML fragment
TUWF::XML 787/s
XML::Writer 832/s
HTML::Tiny 403/s
FU::XMLWriter 5192/s
PostgreSQL client
Fetching query results is highly unlikely to be a bottleneck in your code, this benchmark is mainly here to verify that FU::Pg is not introducing a bottleneck where there shouldn't be one.
Fetch and bitwise-or 20k integers
Smallint Bigint
DBD::Pg 346/s 33/s
Pg::PQ 270/s 24/s
FU::Pg (bin) 476/s 46/s
FU::Pg (text) 273/s 23/s