Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Arnell voidlock

View GitHub Profile
View file.rb
require 'benchmark'
require 'logger'
logger = Logger.new("/dev/null")
logger.level = Logger::INFO
puts "Inspecting 1,000,000 item array"
array = []
1.upto(1_000_000) {|i| array << i}
View file.rb
require 'benchmark'
require 'logger'
logger = Logger.new("/dev/null")
logger.level = Logger::INFO
puts "Inspecting 1,000 item array"
array = []
1.upto(1_000) {|i| array << i}
View file.rb
require 'benchmark'
require 'logger'
logger = Logger.new("/dev/null")
logger.level = Logger::INFO
puts "Small string substition"
array = []
1.upto(10) {|i| array << i}
View file.rb
logger.info "some message"
logger.info { "some message" }
View file.rb
require 'benchmark'
require 'logger'
logger = Logger.new("/dev/null")
logger.level = Logger::INFO
puts "Simple Strings"
Benchmark.bmbm do |x|
x.report("string form") {
100_000.times do
View snippet.rb
class Photo
include DataMapper::Resource
has n, :taggings
has n, :tags, :through => :taggings, 'taggings.deleted_at' => nil
end
class Tag
include DataMapper::Resource
View snippet.rb
module Merb
class Worker
# :api: private
attr_accessor :thread
class << self
# ==== Returns
# Merb::Worker:: instance of a worker.
#
You can’t perform that action at this time.