Skip to content

Instantly share code, notes, and snippets.

@billdueber
Created March 5, 2012 17:30
Show Gist options
  • Save billdueber/1979628 to your computer and use it in GitHub Desktop.
Save billdueber/1979628 to your computer and use it in GitHub Desktop.
marc_marc4j reader producing ruby-marc recofds
Testing on an 18K file in both marc21 and marc-xml. Loop looks like:
reader = MARC::Reader.new(m21file) # or whatever appropriate reader
reader.each do |r|
t = r['245']['a']
end
MARC version is the just-released 0.4.4
The following numbers are for a run with just enough compatibility to run the above code.
It's very possible that with more indirection and more complex getters/setters things will
get a lot slower (i.e., this is mostly just measuring the speed to parse the records
and, in the case of marc/marc4j, stick the fields into a ruby-marc MARC::Record object).
user system total real
MRI 1.8.7 stock strict 51.600000 0.500000 52.100000 ( 52.097472)
MRI 1.8.7 stock forgiving 28.660000 0.320000 28.980000 ( 28.976728)
MRI 1.8.7 stock xml (nokogiri) 66.460000 0.430000 66.890000 ( 66.903439)
MRI 1.8.7 stock xml (libxml) 48.710000 0.370000 49.080000 ( 49.074222)
MRI 1.9.3 stock strict 19.780000 0.210000 19.990000 ( 19.997342)
MRI 1.9.3 stock forgiving 13.430000 0.070000 13.500000 ( 13.502137)
MRI 1.9.3 stock xml (nokogiri) 49.470000 0.360000 49.830000 ( 49.839829)
MRI 1.9.3 stock xml (libxml) 32.930000 0.260000 33.190000 ( 33.285764)
JRuby 1.9.2 stock strict 14.664000 0.000000 14.664000 ( 14.664000)
JRuby 1.9.2 marc4j strict 7.676000 0.000000 7.676000 ( 7.676000)
JRuby 1.9.2 stock forgiving 9.543000 0.000000 9.543000 ( 9.543000)
JRuby 1.9.2 marc4j forgiving 10.391000 0.000000 10.391000 ( 10.391000)
JRuby 1.9.2 stock xml (nokogiri) 43.023000 0.000000 43.023000 ( 43.023000)
JRuby 1.9.2 marc4j xml 4.893000 0.000000 4.893000 ( 4.893000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment