Skip to content
Snippets Groups Projects
Commit f671a853 authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Added benchmark to compare with ObjectSpace

parent fadaa7fa
No related branches found
No related tags found
No related merge requests found
Pipeline #
$:.unshift(File.expand_path('../../lib', __FILE__))
require 'allocations'
require 'benchmark/ips'
require_relative 'benchmark_helper'
Allocations.start
strings = 10_000.times.map { 'a' * 32 }
Benchmark.ips do |bench|
bench.report 'ObjectSpace' do
ObjectSpace.each_object(String).count
end
bench.report 'Allocations' do
Allocations.to_hash[String]
end
bench.compare!
end
Allocations.stop
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment