Sha256: a23f1d4813e8b2bc1c36f92e8a78aacecbc076d674c4f31fa94f03441f8ab0f0

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

#
# = sample/benchmark_clustalw_report.rb - Benchmark tests for Bio::ClustalW::Report
#
# Copyright::   Copyright (C) 2013
#               Andrew Grimm <andrew.j.grimm@gmail.com>
# License::     The Ruby License

require 'pathname'
load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 1, "test",
                            'bioruby_test_helper.rb')).cleanpath.to_s

require 'benchmark'
require 'bio'

class BenchmarkClustalWReport

  DataDir = File.join(BioRubyTestDataPath, 'clustalw')
  Filenames = [ 'example1.aln', 'example1-seqnos.aln' ]

  def self.benchmark_clustalw_report
    Filenames.each do |fn|
      print "\n", fn, "\n"
      fullpath = File.join(DataDir, fn)
      self.new(fullpath).benchmark
    end
  end

  def initialize(aln_filename)
    @text = File.open(aln_filename, 'rb') { |f| f.read }
    @text.freeze
  end

  def benchmark
    GC.start
    Benchmark.bmbm do |x|
      x.report do
        for i in 1...10_000
          aln = Bio::ClustalW::Report.new(@text)
          aln.alignment
        end
      end
    end
  end

end #class BenchmarkClustalWReport

BenchmarkClustalWReport.benchmark_clustalw_report

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bio-2.0.5 sample/benchmark_clustalw_report.rb
bio-2.0.4 sample/benchmark_clustalw_report.rb
bio-2.0.3 sample/benchmark_clustalw_report.rb
bio-2.0.2 sample/benchmark_clustalw_report.rb
bio-2.0.1 sample/benchmark_clustalw_report.rb
bio-2.0.0 sample/benchmark_clustalw_report.rb
bio-1.6.0.pre.20181210 sample/benchmark_clustalw_report.rb
bio-1.5.2 sample/benchmark_clustalw_report.rb
bio-1.5.1 sample/benchmark_clustalw_report.rb
bio-1.5.0 sample/benchmark_clustalw_report.rb