in reply to How do I test the deep equality of two hash tables?

I checked with benchmark module to know which method is quick, but storable gives the result too quick than eq_deeply of Test::Deep.
Too quick? I never complained that an operation was too quick.

Is Test::Deep actually too slow for you?

I couldn't understand why the test::deep is taking too much of time than storable.

Perhaps Storable does most of its work in C, while Test::Deep is pure perl?

Does eq_deeply provide any other advantage on comparison than storable?

Since Storable isn't specifically designed for comparing data, it's dangerous unless it's asserted in the docs that it'll always work.

Storable just takes a binary image of a data structure, and it knows how to reverse that process. Afaicti It doesn't guarantee that two identical data structures always result in the same binary image.

BTW you can also look at Data::Compare, which seems to do a similar job.

  • Comment on Re: How do I test the deep equality of two hash tables?

Replies are listed 'Best First'.
Re^2: How do I test the deep equality of two hash tables?
by blazar (Canon) on Jul 04, 2008 at 07:55 UTC
    Since Storable isn't specifically designed for comparing data, it's dangerous unless it's asserted in the docs that it'll always work

    I personally believe that since it's what that's suggested in the Q&A entry that the OP read, if that is not the case, then the entry itself should be amended.

    Perhaps Storable does most of its work in C, while Test::Deep is pure perl?

    OTOH and incidentally, I suppose that deep equality checking functions from test modules stop traversing the data structures they're given as soon as a difference is found...

    --
    If you can't understand the incipit, then please check the IPB Campaign.
      I personally believe that since it's what that's suggested in the Q&A entry that the OP read, if that is not the case, then the entry itself should be amended.

      No, I suspect I was wrong. I re-read the Storable documentation and now I'm convinced that it's actually legal to use it for comparison if $Storable::canonical is set to a true value. Maybe I should have read it first...