Permalink
Browse files

Try the hashery gem as an outsourced LRU Hash implementation

* benchmarking shows it's performance is roughly equal to the lrucache
  gem and roughly twice as fast as rufus-lru and my homebrew attempt
  • Loading branch information...
1 parent 72d1394 commit 0dc1a3acab4d8afb5a81c1d176c34d87befe2322 @yob committed Jul 15, 2012
Showing with 3 additions and 3 deletions.
  1. +2 −2 lib/pdf/reader/object_cache.rb
  2. +1 −1 pdf-reader.gemspec
@@ -1,6 +1,6 @@
# coding: utf-8
-require 'rufus-lru'
+require 'hashery'
class PDF::Reader
@@ -19,7 +19,7 @@ class ObjectCache # nodoc
def initialize(lru_size = 1000)
@objects = {}
- @lru_cache = Rufus::Lru::Hash.new(lru_size.to_i)
+ @lru_cache = Hashery::LRUHash.new(lru_size.to_i)
@hits = 0
@misses = 0
end
View
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
spec.add_dependency('Ascii85', '~> 1.0.0')
spec.add_dependency('ruby-rc4')
- spec.add_dependency('rufus-lru')
+ spec.add_dependency('hashery', '~> 2.0')
spec.post_install_message = <<END_DESC

0 comments on commit 0dc1a3a

Please sign in to comment.