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.39
DBD::Pg 3.18.0
FU 1.2
HTML::Tiny 1.08
JSON::PP 4.16
JSON::SIMD 1.06
JSON::Tiny 0.58
JSON::XS 4.03
Pg::PQ 0.15
TUWF::XML 1.5
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      5312/s      5119/s      1290/s
      JSON::Tiny      7757/s           -      3426/s
Cpanel::JSON::XS    114802/s    104141/s    107274/s
      JSON::SIMD    130137/s    118948/s    115123/s
        JSON::XS    128421/s    120243/s    117940/s
        FU::Util    132067/s    111328/s    117781/s

Object (small)

                      Encode   Canonical      Decode
        JSON::PP       907/s       829/s       202/s
      JSON::Tiny      1224/s           -       499/s
Cpanel::JSON::XS     45732/s     30862/s     20102/s
      JSON::SIMD     49019/s     30699/s     23267/s
        JSON::XS     49814/s     31326/s     25336/s
        FU::Util     39684/s     24971/s     17998/s

Object (large)

                      Encode   Canonical      Decode
        JSON::PP       927/s       747/s       104/s
      JSON::Tiny      1108/s           -       392/s
Cpanel::JSON::XS     30587/s     11875/s     15515/s
      JSON::SIMD     24418/s     12388/s     22895/s
        JSON::XS     23192/s     13174/s     23553/s
        FU::Util     35489/s     13247/s     16571/s

Object (large, mixed unicode)

                      Encode   Canonical      Decode
        JSON::PP       817/s       679/s        86/s
      JSON::Tiny      1036/s           -       402/s
Cpanel::JSON::XS     25333/s      1459/s      7480/s
      JSON::SIMD     25031/s      1331/s     15997/s
        JSON::XS     23580/s      1375/s      8526/s
        FU::Util     32519/s     12488/s      9290/s

Small integers

                      Encode      Decode
        JSON::PP       113/s        29/s
      JSON::Tiny       160/s        86/s
Cpanel::JSON::XS      7345/s      6151/s
      JSON::SIMD      7963/s      4361/s
        JSON::XS      7915/s      6058/s
        FU::Util      7851/s      5828/s

Large integers

                      Encode      Decode
        JSON::PP      2176/s       329/s
      JSON::Tiny      2999/s      1638/s
Cpanel::JSON::XS     32545/s     50162/s
      JSON::SIMD     37201/s     51719/s
        JSON::XS     36722/s     50110/s
        FU::Util    109163/s     63176/s

ASCII strings

                      Encode      Decode
        JSON::PP      2934/s       336/s
      JSON::Tiny      4126/s      1439/s
Cpanel::JSON::XS    116721/s     44560/s
      JSON::SIMD    134711/s     50429/s
        JSON::XS    135419/s     43976/s
        FU::Util    162246/s     44216/s

Unicode strings

                      Encode      Decode
        JSON::PP      5113/s       253/s
      JSON::Tiny      6603/s      2585/s
Cpanel::JSON::XS     97039/s     67669/s
      JSON::SIMD    106928/s    102440/s
        JSON::XS    105473/s     60558/s
        FU::Util    201648/s     57397/s

String escaping (few)

                      Encode      Decode
        JSON::PP      4251/s       352/s
      JSON::Tiny      4704/s      1869/s
Cpanel::JSON::XS    136755/s    118059/s
      JSON::SIMD    158171/s    153692/s
        JSON::XS    157261/s     97676/s
        FU::Util    225259/s     92515/s

String escaping (many)

                      Encode      Decode
        JSON::PP      3963/s       561/s
      JSON::Tiny      4463/s      2175/s
Cpanel::JSON::XS    197154/s    133102/s
      JSON::SIMD    199955/s    152557/s
        JSON::XS    231905/s    125191/s
        FU::Util    215367/s    118073/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       795/s
  XML::Writer       833/s
   HTML::Tiny       423/s
FU::XMLWriter      5327/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       194/s        22/s
       Pg::PQ       226/s        19/s
 FU::Pg (bin)       245/s        22/s
FU::Pg (text)       217/s        20/s