Sha256: cdc11eca5228bdf10ee3ac7a9383e094cd44b3cc481a28dc50e4e7f24a2c2300
Contents?: true
Size: 832 Bytes
Versions: 2
Compression:
Stored size: 832 Bytes
Contents
# -*- ruby encoding: utf-8 -*- module Benchmarks class ObjectCounts def self.report(columnar: false, full: false) new(columnar: columnar).report end def initialize(columnar: false, full: false) @columnar = columnar @full = full end def report collect @before.keys.grep(/T_/).map { |key| [ key, @after[key] - @before[key] ] }.sort_by { |_, delta| -delta }.each { |key, delta| puts '%10s +%6d' % [ key, delta ] } end private def collect @before = count_objects if @columnar require 'mime/types' MIME::Types.first.to_h if @full else require 'mime/types/full' end @after = count_objects end def count_objects GC.start ObjectSpace.count_objects end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
ish_lib_manager-0.0.1 | test/dummy/vendor/bundle/ruby/2.3.0/gems/mime-types-3.0/support/benchmarks/object_counts.rb |
mime-types-3.0 | support/benchmarks/object_counts.rb |