This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def instances(&block) | |
GC.enable_stats | |
GC.clear_stats | |
block.call | |
warmup_objs = GC.num_allocations | |
warmup_bytes = GC.allocated_size | |
GC.clear_stats | |
block.call | |
puts "=" * 50 | |
puts "ActiveRecord::IdentityMap.enabled: #{ActiveRecord::IdentityMap.enabled}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def instances(&block) | |
GC.enable_stats | |
GC.clear_stats | |
block.call | |
warmup_objs = GC.num_allocations | |
warmup_bytes = GC.allocated_size | |
GC.clear_stats | |
block.call | |
puts "=" * 50 | |
puts "ActiveRecord::IdentityMap.enabled: #{ActiveRecord::IdentityMap.enabled}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# instances method | |
def instances(&block) | |
GC.enable_stats | |
GC.clear_stats | |
block.call | |
warmup_objs = GC.num_allocations | |
warmup_bytes = GC.allocated_size | |
GC.clear_stats | |
block.call | |
puts "Objects:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'barby' | |
require 'barby/outputter/cairo_outputter' | |
require 'rbench' | |
dimensions = {:height => 70, :margin => 10} | |
barcode = Barby::Code128C.new('081300010000102771000000000000500000000084') | |
TIMES = 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convert_to_png(src, out) | |
system("gs -sDEVICE=ppmraw -r144x144 -sOutputFile=- -sNOPAUSE \ | |
-q #{src} -c showpage -c quit | pnmcrop | pnmmargin -white 10 | pnmtopng > #{out} 2> /dev/null") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convert_to_png(src, out) | |
system("gs -sDEVICE=ppmraw -r144x144 -sOutputFile=- -sNOPAUSE \ | |
-q #{src} -c showpage -c quit | pnmcrop | pnmmargin -white 10 | pnmtopng > #{out} 2> /dev/null") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails/master | |
| AR | | |
------------------------------------------------------------------ | |
Model#id x100000 | 0.967 | | |
Model.new (instantiation) x10000 | 0.324 | | |
Model.new (setting attributes) x10000 | 0.892 | | |
Model.first x10000 | 4.504 | | |
Model.all limit(100) x1000 | 11.838 | | |
Model.all limit(100) with relationship x1000 | 27.571 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def debug | |
p "=" * 100 | |
yield | |
p "=" * 100 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- options.assert_valid_keys(VALID_FIND_OPTIONS) | |
+ finders.assert_valid_keys(VALID_FIND_OPTIONS) | |
+ finders = options.dup | |
+ finders.delete_if { |key, value| value.nil? } | |
- [:joins, :select, :group, :having, :limit, :offset, :from, :lock].each do |finder| | |
- if value = options[finder] | |
- relation = relation.send(finder, value) | |
- end | |
- end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set go-=T | |
set bg=dark | |
if &background == "dark" | |
hi normal guibg=black | |
set transp=8 | |
endif | |
set wildmenu | |
set lines=120 | |
set columns=130 |