[ABE.pm] self-modifying data structures

Ted Fiedler fiedlert at gmail.com
Tue Jun 5 18:17:44 PDT 2007


>
> On 6/5/07, Ted Fiedler <fiedlert at gmail.com> wrote:
>
> >
> > I would just prepare and execute a statement... Then use a sub like this
> > ( which returns a hash ) then compare the hashes.
> >
>
>
> I'm going to have to digest this and get back to you.
>


Ive been chewing on it for a year. Another thing I sometimes do depending on
the size of the hash is to do md5 summing of the structure.

get an md5 of the whole hash if thats different, get an md5 of each row ( by
key ) if its the same move on, if the row md5 is different then I will
actually compare the data. doing the check sums of the whole row is faster
than comparing each value - mileage varies.

so Ill have something that looks like this

%table1 = (
    key1 => ( md5sum => 123456,
                 data => [ x,x,y,c ] ),
    key2 => ( md5sum => 124567,
                   data => [5,6,,d,NULL,2],
);

next if  ( $table1{key1}{md5sum} = $table2{key1}{md5sum} );

Then compare the data in the arrays...

Ive seen some things that Ric has posted regarding Perl 5.10 that may make
my life easier ie switch statement and given that Im pretty eager to try.

Ted

--
>
> Faber
>
>
>


-- 
The optimist thinks that this is the best of all possible worlds,
and the pessimist knows it.
                -- J. Robert Oppenheimer, "Bulletin of Atomic Scientists"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/abe-pm/attachments/20070605/4e4b1673/attachment.html 


More information about the ABE-pm mailing list