Skip to content

Instantly share code, notes, and snippets.

@spraints
Last active May 26, 2017
Embed
What would you like to do?
require "benchmark/ips"
require "mochilo"
system "uname -a"
puts "ruby #{RUBY_VERSION}"
Benchmark.ips do |x|
enc_opts = {Symbol => [0x01, lambda { |sym| sym.to_s }]}
dec_opts = {0x01 => lambda { |raw| raw.to_sym }}
str = ["a string"] * 100
sym = [:symbol] * 100
x.report("string") { Mochilo.unpack(Mochilo.pack(str)) }
x.report("symbol") { Mochilo.unpack(Mochilo.pack(sym, enc_opts), dec_opts) }
end
source "https://rubygems.org"
gem "mochilo", :git => "https://github.com/spraints/mochilo", :ref => "custom-type-registry"
gem "benchmark-ips"
GIT
remote: https://github.com/spraints/mochilo
revision: 458fcb528b704bae7bff074d9aa27ee2ccb9449d
ref: custom-type-registry
specs:
mochilo (2.0)
GEM
remote: https://rubygems.org/
specs:
benchmark-ips (2.7.2)
PLATFORMS
ruby
DEPENDENCIES
benchmark-ips
mochilo!
BUNDLED WITH
1.14.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment