Help language development. Donate to The Perl Foundation

TOML::Thumb zef:JRaspass last updated on 2021-07-26

bench.raku
use lib 'lib';

use Bench;
use Test;

constant $toml = q:to/TOML/;
# This is a TOML document

title = "TOML Example"

[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00

[database]
enabled = true
ports = [ 8000, 8001, 8002 ]
data = [ ["delta", "phi"], [3.14] ]
temp_targets = { cpu = 79.5, case = 72.0 }

[servers]

[servers.alpha]
ip = "10.0.0.1"
role = "frontend"

[servers.beta]
ip = "10.0.0.2"
role = "backend"
TOML

my ( $foo, $bar );
Bench.new.cmpthese: 1e3, {
    toml       => sub { use TOML;        $foo = from-toml $toml },
    toml-thumb => sub { use TOML::Thumb; $bar = from-toml $toml },
};

is-deeply $foo, $bar, 'Output is identical';