#!/usr/bin/env perl

use strict;
use warnings;

use Benchmark qw/cmpthese timethese/;
use Koha::Holds;

my $hold = Koha::Holds->find( 2405 );

cmpthese(
    -10,
    {
        objectMethodAtD => sub {
            for ( my $i = 0 ; $i < 250 ; $i++ ) {
                my $found = $hold->is_at_destination;
            }
        },
        objectMethodIsW => sub {
            for ( my $i = 0 ; $i < 250 ; $i++ ) {
                my $found = $hold->is_waiting;
            }
        },
        objectMethodIsF => sub {
            for ( my $i = 0 ; $i < 250 ; $i++ ) {
                my $found = $hold->is_found;
            }
        },
        objectAccessorF => sub {
            for ( my $i = 0 ; $i < 250 ; $i++ ) {
                my $found = $hold->found;
            }
        },
        objectAccessorW => sub {
            for ( my $i = 0 ; $i < 250 ; $i++ ) {
                my $found = $hold->found;
                my $wait = $found && $found eq 'W';
            }
        },
    }
);
