Permalink
Commits on Jun 20, 2017
  1. 0.16.0

    committed Jun 20, 2017
  2. rubocop -a

    committed Jun 20, 2017
  3. Merge pull request #67 from JoeMcB/flush-class-memoizations

    Add support for class-level cache flushing.
    committed on GitHub Jun 20, 2017
  4. Merge branch 'master' into flush-class-memoizations

    committed on GitHub Jun 20, 2017
  5. Merge pull request #68 from PikachuEXE/fix/flush-cache

    Fix undefined `memoized_methods` error raised when a parent class has not call `memoize`
    committed on GitHub Jun 20, 2017
  6. Fix undefined `memoized_methods` error raisied when parent class does…

    … not call `memoize`
    PikachuEXE committed Jun 20, 2017
Commits on May 31, 2017
Commits on May 16, 2017
  1. Use the latest minitest

    committed May 16, 2017
Commits on May 11, 2017
  1. Merge pull request #64 from jrafanie/add_ruby_24

    Add ruby 2.4 to travis (bump 2.2 and 2.3 versions)
    committed on GitHub May 11, 2017
Commits on May 4, 2017
Commits on May 3, 2017
  1. Add ruby 2.4 to travis

    jrafanie committed May 3, 2017
Commits on Oct 21, 2016
  1. Merge pull request #56 from matthewrudy/ruby-1.9.3+

    Fix tests for Ruby < 1.9.3
    committed on GitHub Oct 21, 2016
  2. Fix travis with jruby-head

    Add the before_install and before_script helpers from rake
    Should fix it
    committed Oct 21, 2016
  3. Steal the ruby list from the rake travis.yml

    committed Oct 21, 2016
  4. ruby < 1.9.3 needs an older version of rake

    committed Oct 21, 2016
  5. Merge pull request #53 from biow0lf/update-readme

    Update readme
    committed on GitHub Oct 21, 2016
  6. Merge pull request #55 from joshuapinter/patch-1

    Add return in comments for `flush_cache`.
    committed on GitHub Oct 21, 2016
Commits on Oct 19, 2016
Commits on Sep 5, 2016
  1. Use https instead http

    biow0lf committed on GitHub Sep 5, 2016
  2. Update README.md

    biow0lf committed on GitHub Sep 5, 2016
Commits on Aug 23, 2016
  1. 0.15.0

    committed Aug 23, 2016
  2. Merge pull request #52 from matthewrudy/remove-test-warnings

    Remove test warnings
    committed on GitHub Aug 23, 2016
Commits on Aug 22, 2016
  1. Avoid overwriting the memoized_methods helper

    committed Aug 22, 2016
Commits on Feb 11, 2016
  1. Merge pull request #44 from olivierlacan/patch-1

    Use SVG badge over PNG
    committed Feb 11, 2016
Commits on Feb 9, 2016
  1. Use SVG badge over PNG

    olivierlacan committed Feb 9, 2016
Commits on Jan 3, 2016
Commits on Dec 29, 2015
Commits on Dec 26, 2015
  1. Test against 2.3.0

    committed Dec 26, 2015
Commits on Dec 15, 2015
  1. 0.14.0

    committed Dec 15, 2015
Commits on Dec 14, 2015
  1. Merge pull request #38 from jrafanie/faster2

    Faster2: Cache the method, ivar, and arity and the ancestry memoized methods
    committed Dec 14, 2015
Commits on Dec 10, 2015
  1. Cache the method, ivar, and arity and the ancestry memoized methods

    We can limit calls to memoized_ivar_for/unmemoized_method_for and
    related methods for things we've already calculated initially on the
    memoize :some_method call.
    
    Fixes prime_cache not priming inherited memoized methods, broken by #36
    Fixes (un)memoize_all not clearing/priming subclass identifiers
    
    flush_cache now:             121143.3 i/s
    flush_cache PR 34:            16079.4 i/s - 7.53x slower
    flush_cache master:            3718.0 i/s - 32.58x slower
    
    flush_cache with args now:    43484.0 i/s
    flush_cache with args PR 34:  17488.5 i/s - 2.49x slower
    flush_cache with args master: 17279.3 i/s - 2.52x slower
    
    prime_cache now:              55946.9 i/s
    prime_cache PR 34:            12665.0 i/s - 4.42x slower
    prime_cache master:            6057.2 i/s - 9.24x slower
    
    prime_cache with args now:    30015.3 i/s
    prime_cache with args PR 34:  14012.1 i/s - 2.14x slower
    prime_cache with args master: 13914.9 i/s - 2.16x slower
    
    For a class with 40 memoized methods, total allocations is also
    greatly reduced where each method below is called 1,000 times:
    
    method | PR 34 | master | now
    ------ | ----- | ----- | ---
    prime_cache with args | 363421 | 164000 | 45004
    prime_cache no args | 630535 | 168000 | 41000
    flush_cache with args | 643361 | 164000 | 5000
    flush_cache no args | 907607 | 168000 | 1000
    
    SCRIPT:
    ```ruby
    def log_all_allocations(key = :line)
      require 'allocation_tracer'
    
      trace_keys = %i{path type class} if [:path, :file].include?(key)
      trace_keys = %i{line path type class} if key == :line
    
      ObjectSpace::AllocationTracer.setup(trace_keys)
      return_from_yield = nil
      result = ObjectSpace::AllocationTracer.trace do
        return_from_yield = yield
        nil
      end
    
      puts "Total: #{result.values.inject(0) { |count, v| count += v[0]}}"
      return_from_yield
    end
    
    require './lib/memoist'
    require 'set'
    
    $methods = Set.new
    class Person
      extend Memoist
      1.upto(20) do |n|
        method = define_method("test_#{n}".to_sym) {}
        memoize(method)
        $methods.add(method)
      end
    
      1.upto(20) do |n|
        method = define_method("test_#{n}?".to_sym) {}
        memoize(method)
        $methods.add(method)
      end
    end
    
    puts "prime_cache with args"
    p = Person.new
    log_all_allocations(:line) do
      1_000.times do
        p.prime_cache(*$methods)
      end
    end
    
    puts "prime_cache no args"
    p = Person.new
    log_all_allocations(:line) do
      1_000.times do
        p.prime_cache
      end
    end
    
    puts "flush_cache with args"
    p = Person.new
    log_all_allocations(:line) do
      1_000.times do
        p.flush_cache(*$methods)
      end
    end
    
    puts "flush_cache no args"
    p = Person.new
    log_all_allocations(:line) do
      1_000.times do
        p.flush_cache
      end
    end
    ```
    jrafanie committed Nov 30, 2015