Skip to content

Instantly share code, notes, and snippets.

Jesse Storimer jstorimer

Block or report user

Report or block jstorimer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jstorimer / -
Last active Dec 25, 2015
Vim plugins + vimrc
View -
git_bundles = [
View gist:6337721
require 'socket'
client ='localhost', 4481)
payload = "Lorem ipsum" * 100_000
total_bytes_written = 0
remaining_payload = payload
puts 'looping'
jstorimer / tclient.rb
Created Jun 25, 2013
These scripts were the result of the "Faster Rails test runs...with Unix!" screencast at
View tclient.rb
#!/usr/bin/env ruby
require 'socket'
test_file = ARGV[0]
socket ='testing.sock')
View check_then_set_with_sheep_lock.rb
class Sheep
def initialize
@shorn = false
# Here the sheep owns the mutex. But now the
# shearing logic is muddied up by synchronization
# logic. This doesn't seem like the right place for
# this.
@mutex =
View gist:5314556
require 'benchmark'
require 'thread'
require 'disruptor'
require_relative 'atomic_linked_queue'
$thread_count = 50
$iterations = 10
Thread.abort_on_exception = true

This is a proof-of-concept of a couple of concurrent data structures written in Ruby.

The implementations are heavily commented for those interested. There are benchmarks (with results) included below. The results are interesting, but, as always, take with a grain of salt.

Data structures

AtomicLinkedQueue is a lock-free queue, built on atomic CAS operations.

View gist:5051731
array =
trap(:INT) do
p array.size
end do
loop do
array << 2
View gist:4115880
~/projects/shopify > cap staging deploy
* 2012-11-19 22:55:20 executing `staging'
* 2012-11-19 22:55:20 executing `set_staging_servers'
* 2012-11-19 22:55:20 executing `deploy'
triggering before callbacks for `deploy'
* 2012-11-19 22:55:20 executing `deploy:lock'
servers: [""]
** sftp upload #<StringIO:0x007fe0c24fe2f0> -> /u/apps/shopify/shared/system/lock.txt
[] /u/apps/shopify/shared/system/lock.txt
[] done
View module-testing.rb
class Foo
include {
def this_works
include do
def this_doesnt_work
View gist:3881331
class Foo
include {
def this_works
include do
def this_doesnt_work
You can’t perform that action at this time.