Sha256: 1001b30323bf524f9b38e84f83a353523a6e3e5a28ace12d4cd640aa6c07ba1b
Contents?: true
Size: 997 Bytes
Versions: 2
Compression:
Stored size: 997 Bytes
Contents
# encoding: utf-8 # require 'spec_helper' describe "Memory optimization" do it 'saves memory' do # Remove all indexes. Picky::Indexes.clear_indexes index = Picky::Index.new :memory_optimization do category :text1 category :text2 category :text3 category :text4 end try = Picky::Search.new index thing = Struct.new(:id, :text1, :text2, :text3, :text4) require 'objspace' GC.start memsize_without_added_thing = ObjectSpace.memsize_of_all(Array) GC.start index.add thing.new(1, 'one', 'two', 'three', 'four') GC.start memsize_with_added_thing = ObjectSpace.memsize_of_all(Array) GC.start memsize_with_added_thing.should > memsize_without_added_thing Picky::Indexes.optimize_memory GC.start memsize_with_optimized_memory = ObjectSpace.memsize_of_all(Array) GC.start memsize_with_optimized_memory.should < memsize_with_added_thing end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
picky-4.29.0 | spec/functional/optimize_memory_spec.rb |
picky-4.28.1 | spec/functional/optimize_memory_spec.rb |