File tree 2 files changed +29
-2
lines changed
2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 1
1
# encoding: utf-8
2
-
3
2
require 'rubygems'
4
3
require 'bundler'
4
+
5
5
begin
6
6
Bundler . setup ( :default , :development )
7
7
rescue Bundler ::BundlerError => e
44
44
45
45
require 'rspec/core/rake_task'
46
46
RSpec ::Core ::RakeTask . new ( :spec )
47
-
48
47
task :default => :spec
49
48
50
49
require 'rdoc/task'
@@ -56,3 +55,30 @@ Rake::RDocTask.new do |rdoc|
56
55
rdoc . rdoc_files . include ( 'README*' )
57
56
rdoc . rdoc_files . include ( 'lib/**/*.rb' )
58
57
end
58
+
59
+ desc "Dump profiling data"
60
+ task :profile do
61
+ require 'benchmark'
62
+ require 'stackprof'
63
+
64
+ $:. unshift File . dirname ( __FILE__ ) + '/lib' # Make Ruby aware of load path
65
+ require './lib/rubyXL'
66
+
67
+ spreadsheets = Dir . glob ( File . join ( "test" , "input" , "*.xls?" ) ) . sort!
68
+
69
+ spreadsheets . each { |input |
70
+ puts "<<<--- Profiling parsing #{ input } ..."
71
+ doc = nil
72
+ StackProf . run ( :mode => :cpu , :interval => 100 ,
73
+ :out => "tmp/stackprof-cpu-parse-#{ File . basename ( input ) } .dump" ) {
74
+ doc = RubyXL ::Parser . parse ( input )
75
+ }
76
+
77
+ output = File . join ( "test" , "output" , File . basename ( input ) )
78
+ puts "--->>> Profiling writing of #{ output } ..."
79
+ StackProf . run ( :mode => :cpu , :interval => 100 ,
80
+ :out => "tmp/stackprof-cpu-write-#{ File . basename ( input ) } .dump" ) {
81
+ doc . write ( output )
82
+ }
83
+ }
84
+ end
Original file line number Diff line number Diff line change
1
+ * .dump
You can’t perform that action at this time.
0 commit comments