Giter VIP home page Giter VIP logo

crystalline's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

crystalline's Issues

Strange benchmarks.

So I tried to benchmark the priority queue against my own queue with the following code to benchmark the code in this repo, and I find the results I get pretty strange.

require "benchmark"

require "./priority_queue"

values = 100_000.times.map { rand(100_000_000) }.to_a

Benchmark.bm do |x|
  queue = PriorityQueue(Int32).new
  x.report("crystalline - push") {
    values.each do |v|
      queue.push(v, v)
    end
  }
  x.report("crystalline - pop") {
    values.size.times do |v|
      queue.pop
    end
  }
  puts queue.size

  queue2 = PriorityQueue(Int32).new
  x.report("crystalline - mixed") {
    values.each_with_index do |v, i|
      queue2.push(v, v)
      if i % 4 == 0
        queue2.pop
      end
    end
  }
  puts queue2.size

end

This outputs

linus@donk:~/prog/pairing_heap$ crystal run src/benchmark.cr --release --no-debug
0
0
                          user     system      total        real
crystalline - push    55.120000   1.290000   56.410000 (  36.032381)
crystalline - pop     0.440000   0.000000   0.440000 (  0.261351)
crystalline - mixed   0.120000   0.000000   0.120000 (  0.069474)

The disconnect between push and mixed is pretty staggering.

For the record, my queue is at https://github.com/yxhuvud/pairing_heap/blob/master/src/priority_queue.cr . It is faster but has slightly different semantics(it picks the least number for starters) and other method names, but it could be interesting to compare against.

Add a shard.yml

While I can lock this library to a particular SHA in my shard.yml, it'd be nice to have a shard.yml with a version so that there can be some semblance of semver throughout the project lifetime.

Thanks for making a great collection!

A>

Absence of ordered set in the library

I am in need of an Ordered Set and am planning to implement one from this library implementation of Red Black tree.

As such to avoid code duplication, I will reimplement the RB Tree Map as an RB Set of pairs. What do you think of it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.