Skip to content

Instantly share code, notes, and snippets.

@mtkd
Created December 24, 2011 22:47
Show Gist options
  • Save mtkd/1518492 to your computer and use it in GitHub Desktop.
Save mtkd/1518492 to your computer and use it in GitHub Desktop.
UUID Benchmarks
require 'benchmark'
require 'uuidtools'
require 'ffi-uuid'
require 'uuid'
Benchmark.bm do |x|
x.report { 100000.times do; UUIDTools::UUID.timestamp_create.to_s; end; }
x.report { 100000.times do; UUID.generate.to_s; end; }
x.report { 100000.times do; FFI::UUID.generate_time.to_s; end; }
end
user system total real
UUIDTools: 3.780000 0.020000 3.810000 ( 3.810895)
UUID: 0.990000 0.000000 0.990000 ( 0.992808)
FFI::UUID 0.210000 0.000000 0.210000 ( 0.205604)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment