#!/usr/bin/perl # # Compare MARC::Record object creation from an XML serialization vs # a YAML one. # use strict; use warnings; use Storable qw(nstore store_fd nstore_fd freeze thaw dclone); use MARC::Record; use MARC::File::XML; use YAML::XS; use Time::HiRes qw(gettimeofday); #test_storable( 1000 ); test_xml( 1000 ); test_yaml( 1000 ); sub test_xml { my $max = shift; my $xml = < 00571nam0a2200133 4500 20080924184404.000 1000 20081018 frey50 Propri��t�� barri��re de la peau LIVR caract��risation de l'organisation des lipides par spectroscopie vibrationnelle Emmanuelle Corb�� Guillard [sous la direction de] Arlette Baillet-Guffroy [S.l.] [s.n.] 2008 1 vol. (66 f.) ill. 30 cm 41714 Corb�� Guillard Emmanuelle 1979-.... 070 0 LIVR 100999 1000 TAMIL TPHB 10352 TAMIL 1000 EOS my $start = gettimeofday; my $count = 0; MARC::File::XML->default_record_format( 'UNIMARC' ); while ( $count < $max ) { my $record = MARC::Record::new_from_xml( $xml, "utf8", 'UNIMARC' ); $count++ } print "Deserialize $count records from XML: ", gettimeofday - $start, "\n"; } sub test_yaml { my $max = shift; my $yaml = <