so I'm working on a Rails side project with a few friends of mine that requires a lot of seed data to be loaded. I have the seed data in a JSON document, which now contains just under 3200 JSON objects, each with the same 3 field names.
I've parsed and seeded this data in Rails, creating a new record for every JSON object. I should note that the object has a few has_many associations.
The issue is, after I've seeded the database with the JSON file, when I'm attempting to load all 3200 records into the page (using just a plain ModelName.all.each block), the load time is ridiculous...about 17826ms (17.8 seconds).
According to the console, it says (Views: 16252.4ms | ActiveRecord 1522.9ms). I've looked into implementing eager loading and pre-loading (and I still am working on it).
My question is, how can I optimize this further? I've tried ModelName.preload(:associationName) for pre-loading, but this doesn't seem to change the repsonse time much at all (perhaps I'm doing it incorrectly). What boggles my mind is that 3200 records is not very much...why is this taking so long? Would incorporating something quicker like Redis be a viable option this early in the project?
ModelName.all.eachin the view?ModelName.allis in a controller variable which gets called in the view witheach