Skip to content

Commit

Permalink
chore: fix memory usage benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ElMassimo committed Mar 20, 2023
1 parent 516c503 commit e94694c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions benchmarks/memory_usage_benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
end

before do
AlbumSerializer.send(:instance)
AlbumSerializer.one_as_hash(album)
LegacyAlbumSerializer.new(album).to_json
AlbumBlueprint.render(album)
end

def allocated_by(entry)
Expand All @@ -26,7 +28,9 @@ def allocated_by(entry)
x.compare!
end
entries = report.comparison.entries
expect(entries.map(&:label)).to eq %w[oj_hash oj blueprinter ams]
oj1, oj2, *rest = entries.map(&:label)
expect([oj1, oj2]).to contain_exactly(*%w[oj_hash oj])
expect(rest).to eq %w[blueprinter ams]
expect(allocated_by(entries.first) / allocated_by(entries.last)).to be < 0.365
end

Expand Down

0 comments on commit e94694c

Please sign in to comment.