Sha256: 2063e596b3252d4d087824c51b29118e2fdbb40aa0f66aaccb667050fbd104fa

Contents?: true

Size: 776 Bytes

Versions: 11

Compression:

Stored size: 776 Bytes

Contents

require 'bundler/gem_tasks'

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec

desc 'Open an irb session preloaded with this library'
task :console do
  sh 'irb -rubygems -I lib -r clumpy.rb'
end

desc 'Run a simple benchmarking (cluster 100_000 random points)'
task :benchmark do
  require 'benchmark'
  require 'clumpy'

  number = 100_000
  points = []
  number.times do
    points << OpenStruct.new(
      latitude: rand(Clumpy::Builder::MAX_LATITUDE_DISTANCE),
      longitude: rand(Clumpy::Builder::MAX_LONGITUDE_DISTANCE)
    )
  end

  Benchmark.bm do |x|
    x.report("normal precision") { Clumpy::Builder.new(points).cluster }
    x.report("  high precision") { Clumpy::Builder.new(points, precision: :high).cluster }
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
clumpy-1.1.0 Rakefile
clumpy-1.0.0 Rakefile
clumpy-0.2.8 Rakefile
clumpy-0.2.7 Rakefile
clumpy-0.2.6 Rakefile
clumpy-0.2.5 Rakefile
clumpy-0.2.4 Rakefile
clumpy-0.2.3 Rakefile
clumpy-0.2.2 Rakefile
clumpy-0.2.1 Rakefile
clumpy-0.2.0 Rakefile