diff options
| author | ochko <[email protected]> | 2012-03-26 20:02:51 +0900 |
|---|---|---|
| committer | ochko <[email protected]> | 2012-03-26 20:02:51 +0900 |
| commit | 6b0107b50e04bd57385860238a035f0752d2dad8 (patch) | |
| tree | bbca5ff1b3d2b3926445165490bc1155bb469760 | |
| parent | 42f45f4138a1f71b19411fd8600f2a2bce67a46b (diff) | |
| download | caxlsx-6b0107b50e04bd57385860238a035f0752d2dad8.tar.gz caxlsx-6b0107b50e04bd57385860238a035f0752d2dad8.zip | |
add perftools.rb
| -rw-r--r-- | axlsx.gemspec | 1 | ||||
| -rw-r--r-- | test/profile.rb | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/axlsx.gemspec b/axlsx.gemspec index c8fda02f..d67401d3 100644 --- a/axlsx.gemspec +++ b/axlsx.gemspec @@ -29,6 +29,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'yard' s.add_development_dependency 'yard' s.add_development_dependency 'rdiscount' + s.add_development_dependency 'perftools.rb' s.required_ruby_version = '>= 1.8.7' s.require_path = 'lib' diff --git a/test/profile.rb b/test/profile.rb new file mode 100644 index 00000000..97d2e2bc --- /dev/null +++ b/test/profile.rb @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby -s +# -*- coding: utf-8 -*- + +# Usage: +# > ruby test/profile.rb +# > pprof.rb --gif /tmp/axlsx_noautowidth > /tmp/axlsx_noautowidth.gif +# > open /tmp/axlsx_noautowidth.gif + +$:.unshift "#{File.dirname(__FILE__)}/../lib" +require 'axlsx' +require 'csv' + +# require 'benchmark' +require 'perftools' +row = [] +input = (32..126).to_a.pack('U*').chars.to_a +20.times { row << input.shuffle.join} +times = 1000 + +PerfTools::CpuProfiler.start("/tmp/axlsx_noautowidth") do + p = Axlsx::Package.new + p.use_autowidth = false + wb = p.workbook + + #A Simple Workbook + + wb.add_worksheet do |sheet| + times.times do + sheet << row + end + end + p.serialize("example.xlsx") +end |
