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
# using accessors: | |
attr_volatile :table, :size_control | |
def check_for_resize | |
while (current_table = table) && MAX_CAP > (table_size = current_table.size) && RESIZING != (size_ctrl = size_control) && size_ctrl < @counter.sum | |
try_in_resize_lock(current_table, size_ctrl) do | |
self.table = rebuild(current_table) | |
(table_size << 1) - (table_size >> 1) # 75% load factor | |
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
require 'thread' | |
bignum = (2 ** (0.size * 8)) | |
start = 0 | |
h = {:a => start} | |
h[:a] += bignum # get into the Bignum territory | |
iterations = 100_000 |
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 'thread' | |
bignum = (2 ** (0.size * 8)) | |
start = 0 | |
class H < Hash | |
def [](key) | |
super if key.kind_of?(Symbol) | |
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
An exception occurred running at_exit handlers | |
no block given (LocalJumpError) | |
Backtrace: | |
ERROR: the VM is exiting improperly running at_exit handlers | |
intended operation: :exception | |
associated value: nil | |
destination scope: unknown | |
An exception occurred |
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
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'arel', github: 'rails/arel' | |
gem 'sqlite3' | |
GEMFILE | |
system 'bundle' | |
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 recur(n) | |
if n == 0 | |
bench | |
else | |
recur(n-1) | |
end | |
end | |
def bench |
OlderNewer