Efficient way to compare 2 data structures particularly hash
am 30.04.2011 20:22:57 von Parag Kalra
--20cf3054a6e55cf75304a226e254
Content-Type: text/plain; charset=UTF-8
Hi,
I am evaluating different approaches to compare data structures in Perl -
i.e whether they are same or not.
I am planning to start wit:
1. Data::Compare
2. And then found this -
http://stackoverflow.com/questions/1273616/how-do-i-compare- two-hashes-in-perl-without-using-datacompare
Any other options or suggestions?
I would like to use the most efficient.
~Parag
--20cf3054a6e55cf75304a226e254--
Re: Efficient way to compare 2 data structures particularly hash
am 30.04.2011 20:51:09 von Rob Dixon
On 30/04/2011 19:22, Parag Kalra wrote:
> Hi,
>
> I am evaluating different approaches to compare data structures in Perl -
> i.e whether they are same or not.
>
> I am planning to start wit:
>
> 1. Data::Compare
>
> 2. And then found this -
> http://stackoverflow.com/questions/1273616/how-do-i-compare- two-hashes-in-perl-without-using-datacompare
>
> Any other options or suggestions?
>
> I would like to use the most efficient.
I suggest you take a look at
perldoc -q "How do I test whether two arrays or hashes are equal?"
But have you established that Data::Compare is too inefficient? I
imagine a lot has gone into making it work as well as possible, and if
it is not causing a bottleneck problem then you should go ahead and just
use it.
Rob
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/
Re: Efficient way to compare 2 data structures particularly hash
am 30.04.2011 20:54:36 von Paul Johnson
On Sat, Apr 30, 2011 at 11:22:57AM -0700, Parag Kalra wrote:
> Hi,
>
> I am evaluating different approaches to compare data structures in Perl -
> i.e whether they are same or not.
>
> I am planning to start wit:
>
> 1. Data::Compare
>
> 2. And then found this -
> http://stackoverflow.com/questions/1273616/how-do-i-compare- two-hashes-in-perl-without-using-datacompare
>
> Any other options or suggestions?
>
> I would like to use the most efficient.
Most efficient in terms of what? Data::Compare seems to do what you
want. It is established, tested, maintained, and has no outstanding
reported bugs. Since you know about it, is there any reason to look any
further?
Why evaluate different approaches? I suggest that the most efficient
use of your time would be to use Data::Compare, until you have a reason
not to. Then you can wonder what to use instead.
--
Paul Johnson - paul@pjcj.net
http://www.pjcj.net
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/