[前][次][番号順一覧][スレッド一覧]

ruby-changes:51676

From: k0kubun <ko1@a...>
Date: Sun, 8 Jul 2018 23:38:13 +0900 (JST)
Subject: [ruby-changes:51676] k0kubun:r63888 (trunk): benchmark: introduce benchmark_driver.gem

k0kubun	2018-07-08 23:38:05 +0900 (Sun, 08 Jul 2018)

  New Revision: 63888

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63888

  Log:
    benchmark: introduce benchmark_driver.gem
    
    Makefile.in: Clone benchmark-driver repository in benchmark/benchmark-driver
      `make update-benchmark-driver`, like simplecov.
    win32/Makefile.sub: Roughly do the same thing.
    .gitignore: Ignore the cloned repository.
    common.mk: Trigger `make update-benchmark-driver` to run `make benchmark`
      and adjust arguments for benchmark_driver.gem.
    
    benchmark/require.yml: renamed from benchmark/bm_require.rb, benchmark/prepare_require.rb
    benchmark/require_thread.yml: renamed from benchmark/bm_require_thread.rb, benchmark/prepare_require_thread.rb
    benchmark/so_count_words.yml: renamed from benchmark/bm_so_count_words.rb, benchmark/prepare_so_count_words.rb,
      benchmark/wc.input.base
    benchmark/so_k_nucleotide.yml: renamed from benchmark/bm_so_k_nucleotide.rb, benchmark/prepare_so_k_nucleotide.rb,
      benchmark/make_fasta_output.rb
    benchmark/so_reverse_complement.yml: renamed from benchmark/bm_so_reverse_complement.rb, benchmark/prepare_so_reverse_complement.rb,
      benchmark/make_fasta_output.rb
    
    I'm sorry but I made some duplications between benchmark/require.yml and benchmark/require_thread.yml,
    and between benchmark/so_k_nucleotide.yml and benchmark/so_reverse_complement.yml.
    
    If you're not comfortable with it, please combine these YAMLs to share
    the same prelude. One YAML file can have multiple benchmark definitions
    sharing prelude.
    
    benchmark/driver.rb: Replace its core feature with benchmark_driver.gem.
      Some old features are gone for now, but I'll add them again later.
    
    [Misc #14902]

  Added files:
    trunk/benchmark/require.yml
    trunk/benchmark/require_thread.yml
    trunk/benchmark/so_count_words.yml
    trunk/benchmark/so_k_nucleotide.yml
    trunk/benchmark/so_reverse_complement.yml
  Removed files:
    trunk/benchmark/bm_require.rb
    trunk/benchmark/bm_require_thread.rb
    trunk/benchmark/bm_so_count_words.rb
    trunk/benchmark/bm_so_k_nucleotide.rb
    trunk/benchmark/bm_so_reverse_complement.rb
    trunk/benchmark/make_fasta_output.rb
    trunk/benchmark/prepare_require.rb
    trunk/benchmark/prepare_require_thread.rb
    trunk/benchmark/prepare_so_count_words.rb
    trunk/benchmark/prepare_so_k_nucleotide.rb
    trunk/benchmark/prepare_so_reverse_complement.rb
    trunk/benchmark/wc.input.base
  Modified files:
    trunk/.gitignore
    trunk/Makefile.in
    trunk/benchmark/driver.rb
    trunk/common.mk
    trunk/win32/Makefile.sub
Index: benchmark/prepare_so_reverse_complement.rb
===================================================================
--- benchmark/prepare_so_reverse_complement.rb	(revision 63887)
+++ benchmark/prepare_so_reverse_complement.rb	(nonexistent)
@@ -1,2 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/prepare_so_reverse_complement.rb#L0
-require_relative 'make_fasta_output'
-prepare_fasta_output(2_500_000)

Property changes on: benchmark/prepare_so_reverse_complement.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/prepare_so_count_words.rb
===================================================================
--- benchmark/prepare_so_count_words.rb	(revision 63887)
+++ benchmark/prepare_so_count_words.rb	(nonexistent)
@@ -1,15 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/prepare_so_count_words.rb#L0
-# prepare 'wc.input'
-
-def prepare_wc_input
-  wcinput = File.join(File.dirname($0), 'wc.input')
-  wcbase  = File.join(File.dirname($0), 'wc.input.base')
-  unless FileTest.exist?(wcinput)
-    data = File.read(wcbase)
-    13.times{
-      data << data
-    }
-    open(wcinput, 'w'){|f| f.write data}
-  end
-end
-
-prepare_wc_input

Property changes on: benchmark/prepare_so_count_words.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/wc.input.base
===================================================================
--- benchmark/wc.input.base	(revision 63887)
+++ benchmark/wc.input.base	(nonexistent)
@@ -1,25 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/wc.input.base#L0
-Subject:      Re: Who was Izchak Miller?
-From:         "Jane D. Anonymous" <nobody@y...>
-Date:         1996/04/28
-Message-Id:   <4lv7bc$oh@n...>
-References:   <317C405E.5DFA@p...> <4lk6vl$gde@n...>
-To:           75176.2330@c...
-Content-Type: text/plain; charset=us-ascii
-Organization: Yale University
-X-Url:        news:4lk6vl$gde@n...
-Mime-Version: 1.0
-Newsgroups:   rec.games.roguelike.nethack
-X-Mailer:     Mozilla 1.1N (Macintosh; I; 68K)
-
-Hello there, Izchak Miller was my father.  When I was younger I spent 
-many a night, hunched over the keyboard with a cup of tea, playing 
-nethack with him and my brother.  my dad was a philosopher with a strong 
-weakness for fantasy/sci fi.  I remember when he started to get involved 
-with the Nethack team- my brother's Dungeons and Dragons monster book 
-found a regular place beside my dad's desk. it's nice to see him living 
-on in the game he loved so much :-).  
-                                                                  Tamar Miller
-
-The following is a really long word of 5000 characters:
-
-wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww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wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
 wwwwwwwwwwwwwww

Property changes on: benchmark/wc.input.base
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/bm_require.rb
===================================================================
--- benchmark/bm_require.rb	(revision 63887)
+++ benchmark/bm_require.rb	(nonexistent)
@@ -1,7 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_require.rb#L0
-$:.push File.join(File.dirname(__FILE__), "bm_require.data")
-
-1.upto(10000) do |i|
-  require "c#{i}"
-end
-
-$:.pop

Property changes on: benchmark/bm_require.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/bm_require_thread.rb
===================================================================
--- benchmark/bm_require_thread.rb	(revision 63887)
+++ benchmark/bm_require_thread.rb	(nonexistent)
@@ -1,15 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_require_thread.rb#L0
-$:.push File.join(File.dirname(__FILE__), "bm_require.data")
-
-i=0
-t = Thread.new do
-  while true
-    i = i+1 # dummy loop
-  end
-end
-
-1.upto(100) do |i|
-  require "c#{i}"
-end
-
-$:.pop
-t.kill

Property changes on: benchmark/bm_require_thread.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/prepare_so_k_nucleotide.rb
===================================================================
--- benchmark/prepare_so_k_nucleotide.rb	(revision 63887)
+++ benchmark/prepare_so_k_nucleotide.rb	(nonexistent)
@@ -1,2 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/prepare_so_k_nucleotide.rb#L0
-require_relative 'make_fasta_output'
-prepare_fasta_output(100_000)

Property changes on: benchmark/prepare_so_k_nucleotide.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/make_fasta_output.rb
===================================================================
--- benchmark/make_fasta_output.rb	(revision 63887)
+++ benchmark/make_fasta_output.rb	(nonexistent)
@@ -1,19 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/make_fasta_output.rb#L0
-# prepare 'fasta.output'
-
-def prepare_fasta_output n
-  filebase = File.join(File.dirname($0), 'fasta.output')
-  script = File.join(File.dirname($0), 'bm_so_fasta.rb')
-  file = "#{filebase}.#{n}"
-
-  unless FileTest.exist?(file)
-    STDERR.puts "preparing #{file}"
-
-    open(file, 'w'){|f|
-      ARGV[0] = n
-      $stdout = f
-      load script
-      $stdout = STDOUT
-    }
-  end
-end
-

Property changes on: benchmark/make_fasta_output.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/bm_so_reverse_complement.rb
===================================================================
--- benchmark/bm_so_reverse_complement.rb	(revision 63887)
+++ benchmark/bm_so_reverse_complement.rb	(nonexistent)
@@ -1,30 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_so_reverse_complement.rb#L0
-#!/usr/bin/ruby
-# The Great Computer Language Shootout
-# http://shootout.alioth.debian.org/
-#
-# Contributed by Peter Bjarke Olsen
-# Modified by Doug King
-
-seq=Array.new
-
-def revcomp(seq)
-  seq.reverse!.tr!('wsatugcyrkmbdhvnATUGCYRKMBDHVN','WSTAACGRYMKVHDBNTAACGRYMKVHDBN')
-  stringlen=seq.length
-  0.step(stringlen-1,60) {|x| print seq.slice(x,60) , "\n"}
-end
-
-input = open(File.join(File.dirname($0), 'fasta.output.2500000'), 'rb')
-
-while input.gets
-  if $_ =~ />/
-    if seq.length != 0
-      revcomp(seq.join)
-      seq=Array.new
-    end
-    puts $_
-  else
-    $_.sub(/\n/,'')
-    seq.push $_
-  end
-end
-revcomp(seq.join)

Property changes on: benchmark/bm_so_reverse_complement.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/bm_so_count_words.rb
===================================================================
--- benchmark/bm_so_count_words.rb	(revision 63887)
+++ benchmark/bm_so_count_words.rb	(nonexistent)
@@ -1,19 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_so_count_words.rb#L0
-#!/usr/bin/ruby
-# -*- mode: ruby -*-
-# $Id: wc-ruby.code,v 1.4 2004/11/13 07:43:32 bfulgham Exp $
-# http://www.bagley.org/~doug/shootout/
-# with help from Paul Brannan
-
-input = open(File.join(File.dirname($0), 'wc.input'), 'rb')
-
-nl = nw = nc = 0
-while true
-  tmp = input.read(4096) or break
-  data = tmp << (input.gets || "")
-  nc += data.length
-  nl += data.count("\n")
-  ((data.strip! || data).tr!("\n", " ") || data).squeeze!
-  nw += data.count(" ") + 1
-end
-# STDERR.puts "#{nl} #{nw} #{nc}"
-

Property changes on: benchmark/bm_so_count_words.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/prepare_require.rb
===================================================================
--- benchmark/prepare_require.rb	(revision 63887)
+++ benchmark/prepare_require.rb	(nonexistent)
@@ -1,25 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/prepare_require.rb#L0
-require "fileutils"
-
-def prepare
-  num_files = 10000
-
-  basename = File.dirname($0)
-  data_dir = File.join(basename, "bm_require.data")
-
-  # skip if all of files exists
-  if File.exist?(File.join(data_dir, "c#{num_files}.rb"))
-    return
-  end
-
-  FileUtils.mkdir_p(data_dir)
-
-  1.upto(num_files) do |i|
-    f = File.open("#{data_dir}/c#{i}.rb", "w")
-    f.puts <<-END
-      class C#{i}
-      end
-    END
-  end
-end
-
-prepare

Property changes on: benchmark/prepare_require.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/prepare_require_thread.rb
===================================================================
--- benchmark/prepare_require_thread.rb	(revision 63887)
+++ benchmark/prepare_require_thread.rb	(nonexistent)
@@ -1,2 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/prepare_require_thread.rb#L0
-load File.join(File.dirname(__FILE__), "prepare_require.rb")
-

Property changes on: benchmark/prepare_require_thread.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: benchmark/bm_so_k_nucleotide.rb
===================================================================
--- benchmark/bm_so_k_nucleotide.rb	(revision 63887)
+++ benchmark/bm_so_k_nucleotide.rb	(nonexistent)
@@ -1,48 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/bm_so_k_nucleotide.rb#L0
-# The Computer Language Shootout
-# http://shootout.alioth.debian.org
-#
-# contributed by jose fco. gonzalez
-# modified by Sokolov Yura
-
-seq = String.new
-
-def frecuency( seq,length )
-    n, table = seq.length - length + 1, Hash.new(0)
-    f, i = nil, nil
-    (0 ... length).each do |f|
-        (f ... n).step(length) do |i|
-            table[seq[i,length]] += 1
-        end
-    end
-    [n,table]
-
-end
-
-def sort_by_freq( seq,length )
-    n,table = frecuency( seq,length )
-    a, b, v = nil, nil, nil
-    table.sort{|a,b| b[1] <=> a[1]}.each do |v|
-        puts "%s %.3f" % [v[0].upcase,((v[1]*100).to_f/n)]
-    end
-    puts
-end
-
-def find_seq( seq,s )
-    n,table = frecuency( seq,s.length )
-    puts "#{table[s].to_s}\t#{s.upcase}"
-end
-
-input = open(File.join(File.dirname($0), 'fasta.output.100000'), 'rb')
-
-line = input.gets while line !~ /^>THREE/
-line = input.gets
-
-while (line !~ /^>/) & line do
-    seq << line.chomp
-    line = input.gets
-end
-
-[1,2].each {|i| sort_by_freq( seq,i ) }
-
-%w(ggt ggta ggtatt ggtattttaatt ggtattttaatttatagt).each{|s| find_seq( seq,s) }
-

Property changes on: benchmark/bm_so_k_nucleotide.rb
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-LF
\ No newline at end of property
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 63887)
+++ Makefile.in	(revision 63888)
@@ -515,6 +515,11 @@ gcov: https://github.com/ruby/ruby/blob/trunk/Makefile.in#L515
 lcov:
 	$(Q) $(BASERUBY) $(srcdir)/tool/run-lcov.rb
 
+update-benchmark-driver:
+	$(Q) $(srcdir)/tool/git-refresh -C $(srcdir)/benchmark $(Q1:0=-q) \
+		--branch $(BENCHMARK_DRIVER_GIT_REF) \
+		$(BENCHMARK_DRIVER_GIT_URL) benchmark-driver $(GIT_OPTS)
+
 update-doclie:
 	$(Q) $(srcdir)/tool/git-refresh -C $(srcdir)/coverage $(Q1:0=-q) \
 		--branch $(DOCLIE_GIT_REF) \
Index: benchmark/so_reverse_complement.yml
===================================================================
--- benchmark/so_reverse_complement.yml	(nonexistent)
+++ benchmark/so_reverse_complement.yml	(revision 63888)
@@ -0,0 +1,137 @@ https://github.com/ruby/ruby/blob/trunk/benchmark/so_reverse_complement.yml#L1
+prelude: |
+  bm_so_fasta = <<'EOS'
+  # The Computer Language Shootout
+  # http://shootout.alioth.debian.org/
+  # Contributed by Sokolov Yura
+
+  $last = 42.0
+  def gen_random(max, im=139968, ia=3877, ic=29573)
+      (max * ($last = ($last * ia + ic) % im)) / im
+  end
+
+  alu =
+     "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG"+
+     "GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA"+
+     "CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT"+
+     "ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA"+
+     "GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG"+
+     "AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC"+
+     "AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA"
+
+  iub = [
+      ["a", 0.27],
+      ["c", 0.12],
+      ["g", 0.12],
+      ["t", 0.27],
+
+      ["B", 0.02],
+      ["D", 0.02],
+      ["H", 0.02],
+      ["K", 0.02],
+      ["M", 0.02],
+      ["N", 0.02],
+      ["R", 0.02],
+      ["S", 0.02],
+      ["V", 0.02],
+      ["W", 0.02],
+      ["Y", 0.02],
+  ]
+  homosapiens = [
+      ["a", 0.3029549426680],
+      ["c", 0.1979883004921],
+      ["g", 0.1975473066391],
+      ["t", 0.3015094502008],
+  ]
+
+  def make_repeat_fasta(id, desc, src, n)
+      puts ">#{id} #{desc}"
+      v = nil
+      width = 60
+      l = src.length
+      s = src * ((n / l) + 1)
+      s.slice!(n, l)
+      puts(s.scan(/.{1,#{width}}/).join("\n"))
+  end
+
+  def make_random_fasta(id, desc, table, n)
+      puts ">#{id} #{desc}"
+      rand, v = nil,nil
+      width = 60
+      chunk = 1 * width
+      prob = 0.0
+      table.each{|v| v[1]= (prob += v[1])}
+      for i in 1..(n/width)
+          puts((1..width).collect{
+              rand = gen_random(1.0)
+              table.find{|v| v[1]>rand}[0]
+          }.join)
+      end
+      if n%width != 0
+          puts((1..(n%width)).collect{
+              rand = gen_random(1.0)
+              table.find{|v| v[1]>rand}[0]
+          }.join)
+      end
+  end
+
+
+  n = (ARGV[0] or 250_000).to_i
+
+  make_repeat_fasta('ONE', 'Homo sapiens alu', alu, n*2)
+  make_random_fasta('TWO', 'IUB ambiguity codes', iub, n*3)
+  make_random_fasta('THREE', 'Homo sapiens frequency', homosapiens, n*5)
+  EOS
+benchmark:
+  - name: so_reverse_complement
+    prelude: |
+      script = File.join(File.dirname($0), 'bm_so_fasta.rb')
+      File.write(script, bm_so_fasta)
+
+      def prepare_fasta_output n
+        filebase = File.join(File.dirname($0), 'fasta.output')
+        script = File.join(File.dirname($0), 'bm_so_fasta.rb')
+        file = "#{filebase}.#{n}"
+
+        unless FileTest.exist?(file)
+          STDERR.puts "preparing #{file}"
+
+          open(file, 'w'){|f|
+            ARGV[0] = n
+            $stdout = f
+            load script
+            $stdout = STDOUT
+          }
+        end
+      end
+      prepare_fasta_output(2_500_000)
+    script: |
+      # The Great Computer Language Shootout
+      # http://shootout.alioth.debian.org/
+      #
+      # Contributed by  (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]