File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 "
100107end
101108
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 |
You can’t perform that action at this time.
0 commit comments