Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added sample perftools script.

  • Loading branch information...
commit 4bed0822c5ce8025079566c68091686a5ba6dd74 1 parent a4c563a
@jnunemaker jnunemaker authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 script/criteria_hash.rb
View
21 script/criteria_hash.rb
@@ -0,0 +1,21 @@
+require 'pp'
+require 'pathname'
+require 'benchmark'
+require 'rubygems'
+require 'bundler'
+
+Bundler.require :default, :performance
+
+root_path = Pathname(__FILE__).dirname.join('..').expand_path
+lib_path = root_path.join('lib')
+$:.unshift(lib_path)
+require 'plucky'
+
+criteria = Plucky::CriteriaHash.new(:foo => 'bar')
+
+PerfTools::CpuProfiler.start("/tmp/criteria_hash") do
+ 1_000_000.times { criteria[:foo] = 'bar' }
+end
+
+puts system "pprof.rb --gif /tmp/criteria_hash > /tmp/criteria_hash.gif"
+puts system "open /tmp/criteria_hash.gif"
Please sign in to comment.
Something went wrong with that request. Please try again.