Skip to content

Instantly share code, notes, and snippets.

@stakach
stakach / gist:5204160
Created March 20, 2013 12:07
Fiber vs Thread using futures
require 'celluloid'
require 'benchmark'
class Example
include Celluloid
def slow_method
sleep 5
end
@stakach
stakach / gist:5204063
Created March 20, 2013 11:47
Celluloid Actors vs Actor Pools - Fibres vs Threads
require 'celluloid'
require 'benchmark'
$mutex = Mutex.new
$resource = ConditionVariable.new
class Example
include Celluloid
def slow_method
source 'https://rubygems.org'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes