Sha256: dca75c71f4c5de709ee00a1099948dcdf0d0af864c9a3a1447b4c19ce9adc2be

Contents?: true

Size: 875 Bytes

Versions: 28

Compression:

Stored size: 875 Bytes

Contents

task :benchmark do
  require 'lib/uuidtools'
  require 'benchmark'

  # Version 1
  result = Benchmark.measure do
    10000.times do
      UUID.timestamp_create.to_s
    end
  end
  puts "#{(10000.0 / result.real)} version 1 per second."

  # Version 3
  result = Benchmark.measure do
    10000.times do
      UUID.md5_create(UUID_URL_NAMESPACE,
        "http://www.ietf.org/rfc/rfc4122.txt").to_s
    end
  end
  puts "#{(10000.0 / result.real)} version 3 per second."

  # Version 4
  result = Benchmark.measure do
    10000.times do
      UUID.random_create.to_s
    end
  end
  puts "#{(10000.0 / result.real)} version 4 per second."

  # Version 5
  result = Benchmark.measure do
    10000.times do
      UUID.sha1_create(UUID_URL_NAMESPACE,
        "http://www.ietf.org/rfc/rfc4122.txt").to_s
    end
  end
  puts "#{(10000.0 / result.real)} version 5 per second."
end

Version data entries

28 entries across 25 versions & 8 rubygems

Version Path
sidekick-client-0.1.0 lib/ext/uuidtools-2.1.1/tasks/benchmark.rake
uuidtools-2.1.1 tasks/benchmark.rake
uuidtools-2.1.0 tasks/benchmark.rake
uuidtools-1.0.4 tasks/benchmark.rake
uuidtools-1.0.7 tasks/benchmark.rake
uuidtools-1.0.6 tasks/benchmark.rake
uuidtools-1.0.5 tasks/benchmark.rake
uuidtools-2.0.0 tasks/benchmark.rake