Project

General

Profile

RE: Performance of cdo with netCDF4 ยป cdoBench.rb

Ralf Mueller, 2013-10-24 15:45

 
require 'benchmark'
include Benchmark # we need the CAPTION and FORMAT constants

n = 10000
Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x|
tf = x.report("plain nc :") { IO.popen("cdo -sinfov -timmean oceLong.nc >/dev/null 2>&1").read }
tt = x.report("plain nc4:") { IO.popen("cdo -sinfov -timmean oceLong.nc4 >/dev/null 2>&1").read }
tu = x.report("nc4 zip:") { IO.popen("cdo -sinfov -timmean oceLong.nc4z >/dev/null 2>&1").read }
[tf+tt+tu, (tf+tt+tu)/3]
end

    (1-1/1)