Skip to content

Commit

Permalink
Change inference cache to use a Threadsafe::Cache
Browse files Browse the repository at this point in the history
* The ThreadSafe::Cache is optimized towards performance while
  giving up some compatibility with the hash interface. It is better
  suited for a cache than ThreadSafe::Hash.
  • Loading branch information
dkubb committed Jan 21, 2014
1 parent 1f1ad49 commit 6b4411d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/axiom/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module Types
Contradiction = ->(_value) { true }.freeze

# Cache the type inference lookup by object
@inference_cache = ThreadSafe::Hash.new do |cache, object|
@inference_cache = ThreadSafe::Cache.new do |cache, object|
type = nil
Type.descendants.detect do |descendant|
type = descendant.infer(object)
Expand Down

0 comments on commit 6b4411d

Please sign in to comment.