It also makes the code a bit harder to read.  Unless there's actually
a tangible performance benefit, I'm not sure it's worth it.

> This patch makes Danga::DNS::Resolver::Query use restricted hashes like
> the other Danga classes.  I assume it will also speed things up a small
> amount.

> -    my ($class, $res, $asker, $host, $type, $now, $id, $data) = @_;
> +    my Danga::DNS::Resolver::Query $self = shift;
> +    $self = fields::new($self) unless ref $self;
>      
> -    my $self = {
> -        resolver    => $res,
> -        asker       => $asker,
> -        host        => $host,
> -        type        => $type,
> -        timeout     => $now,
> -        id          => $id,
> -        data        => $data,
> -        repeat      => 2, # number of retries
> -        ns          => 0,
> -        nqueries    => 0,
> -    };
> +    @$self{qw( resolver asker host type timeout id data )} = @_;
> +    # repeat is number of retries
> +    @$self{qw( repeat ns nqueries )} = (2,0,0);

Reply via email to