Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

base62 convertor in ruby

View benchmark_alphadecimal.rb
1 2 3 4 5 6 7 8 9 10 11 12 13
require 'rubygems'
require 'benchmark'
require 'alphadecimal'
 
time = Benchmark.measure do
1_000_000.times do |i|
encode = i.alphadecimal
decode = encode.alphadecimal
raise "Assertion error!" unless i == decode
end
end
 
puts time # 17.060000 0.050000 17.110000 ( 17.507562)
View benchmark_alphadecimal.rb
1 2 3 4 5 6 7 8 9 10 11 12 13
require 'rubygems'
require 'benchmark'
require 'base62'
 
time = Benchmark.measure do
1_000_000.times do |i|
encode = i.base62_encode
decode = encode.base62_decode
raise "Assertion error!" unless i == decode
end
end
 
puts time # 9.600000 0.020000 9.620000 ( 9.802189)
View benchmark_alphadecimal.rb
1 2 3 4 5 6 7 8 9 10 11 12 13
require 'rubygems'
require 'benchmark'
require 'radix62'
 
time = Benchmark.measure do
1_000_000.times do |i|
encode = i.encode62
decode = encode.decode62
raise "Assertion error!" unless i == decode
end
end
 
puts time # 19.070000 0.040000 19.110000 ( 19.483596)
View benchmark_alphadecimal.rb
1 2 3 4 5 6 7 8 9 10 11 12 13
require 'rubygems'
require 'benchmark'
require 'yab62'
 
time = Benchmark.measure do
1_000_000.times do |i|
encode = i.encode62
decode = encode.decode62
raise "Assertion error!" unless i == decode
end
end
 
puts time # 0.550000 0.000000 0.550000 ( 0.605562)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.