Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Fastest data structure compare?

by Your Mother (Chancellor)
on Oct 08, 2009 at 16:31 UTC ( #800028=note: print w/ replies, xml ) Need Help??


in reply to Fastest data structure compare?

As repellent noted, JSON::XS is *very* fast. For some data sizes (in some benchmarks) it beats Storable. Here's a sample. Note the examples show the main caveat, JSON cares whether things are numbers or strings.

use JSON::XS; my %bingo = ( one => 1, two => 2, three => 5, ); my %bongo = ( three => 5, two => 2, one => 1, ); my %bango = ( one => "1", two => "2", three => "5", ); print "Is bingo bongo? ", encode_json(\%bingo) eq encode_json(\%bongo) ? "yes!\n" : "noes :( +\n"; print "Is bango bongo? ", encode_json(\%bango) eq encode_json(\%bongo) ? "yes!\n" : "noes :( +\n";
Is bingo bongo? yes! Is bango bongo? noes :(


Comment on Re: Fastest data structure compare?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://800028]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (14)
As of 2015-07-06 18:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (80 votes), past polls