Daniel
09/07/2021, 3:16 PMEdwin Cruz
09/07/2021, 3:24 PMEdwin Cruz
09/07/2021, 3:26 PMJared Norman
Daniel
09/07/2021, 3:31 PMDaniel
09/07/2021, 4:24 PMimages: [attachment_attachment: [blob: :variant_records]] but it's not helping. Any ideas?
2. Removing pagination removes 500ms from page rendering.Jared Norman
Edwin Cruz
09/07/2021, 4:56 PMmaster_including_variangs association rater than just variants then it blows the eager loadingDaniel
09/08/2021, 7:25 AMimages: { attachment_attachment: { blob: { variant_records: { image_attachment: :blob } } } }. Reduced page rendering by another 200ms 👍 I'm now at 350ms without pagination in dev env which should be fine in production. Now trying to figure out how to speed up pagination.kennyadsl
Daniel
09/08/2021, 10:03 AMSpree::Product.all that takes ~130ms with 100k records: Spree::Product Load (127.0ms) SELECT "spree_products".* FROM "spree_products" WHERE "spree_products"."deleted_at" IS NULLDaniel
09/08/2021, 10:08 AMlimitDaniel
09/08/2021, 10:22 AM@products.maximum(:updated_at) query in the cache_key_for_products method. Takes 150ms to finish.Daniel
09/08/2021, 10:23 AMDaniel
09/08/2021, 10:25 AMDaniel
09/08/2021, 10:27 AMdev:cache and ignoring the @products.maximum(:updated_at) and count query would reduce page rendering speed to 50ms.kennyadsl
maximum is required when cache is active because it's what tells Rails to invalidate the cache (when you update any product). You can probably find other ways to invalidate that cache thoughDaniel
09/08/2021, 10:51 AMSpree::Preference to act as a cache for maximum and count . Would this be considered as a misuse of Spree::Preference or should I go with something else like https://github.com/huacnlee/rails-settings-cached?Daniel
09/08/2021, 11:12 AMmaximum query issue by using @products.map(&:updated_at).max instead of the additional maximum query.Daniel
09/08/2021, 11:12 AMcount query.kennyadsl
@products.map(&:updated_at).max uses Ruby, and with a lot of records it could be much slower than a query, isn't it?Daniel
09/08/2021, 11:26 AMDaniel
09/08/2021, 11:30 AMCompleted 200 OK in 106ms (Views: 51.4ms | ActiveRecord: 47.5ms | Allocations: 44892) for cached pages.Daniel
09/08/2021, 11:32 AMCompleted 200 OK in 601ms (Views: 121.9ms | ActiveRecord: 471.4ms | Allocations: 91574) due to the count query.kennyadsl
Daniel
09/08/2021, 11:55 AMwithout_count option which disables it (https://stackoverflow.com/a/43267340/587320). This brings down uncached page rendering time to ~230ms.Daniel
09/08/2021, 12:25 PM