Skip to content

Commit 0ea1511

Browse files
committed
group all data creation
1 parent ebd5803 commit 0ea1511

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

perf/benchmark_eager_load.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@
9696
500.times { |n| Cartridge.create!(hardware: Printer.create!(model: "Printer #{n}")) }
9797
500.times { |n| Cartridge.create!(hardware: Scanner.create!(model: "Scanner #{n}")) }
9898

99+
# Add some nested data
100+
Person.limit(1000).each do |person|
101+
person.posts.limit(2).each do |post|
102+
2.times { |i| post.alerts.create!(message: "Alert #{i}") }
103+
end
104+
end
105+
99106
puts "PR #6158 scenario data created. Starting benchmarks...\n"
100107
end
101108

@@ -208,13 +215,6 @@
208215

209216
puts "\n[ Nested Associations Benchmarks ]"
210217

211-
# Add some nested data
212-
Person.limit(1000).each do |person|
213-
person.posts.limit(2).each do |post|
214-
2.times { |i| post.alerts.create!(message: "Alert #{i}") }
215-
end
216-
end
217-
218218
bm.report('nested: normal') do
219219
Person.limit(1000).each do |person|
220220
person.posts.each do |post|

0 commit comments

Comments
 (0)