#!/usr/bin/env perl

use 5.010;
use strict;
use warnings;
use FindBin '$Bin';
use lib "$Bin/../lib";

use Benchmark::Dumb qw(timethese);
use Data::Transmute qw(transmute_hash);

timethese(0, {
    hash => sub {
        # each known rule is specified once, no data is modified. this bench
        # measures "interpreting" speed.
        state $data = {foo=>1};
        state $rules = [
            [create_key => {name=>'foo', value=>'bar', ignore=>1}],
            [rename_key => {from=>'bar', to=>'baz', ignore_missing_from=>1}],
            [delete_key => {name=>'bar'}],
        ];
        transmute_hash(
            data  => $data,
            rules => $rules,
        );
    },
});
