In 1.x Rules used to cache all rules that responded to a specific event. That way a single cache_get provided every object that needed to be evaluated. Commerce Discount made no attempts to replicate this.

In 2.x our Promotion entities are light, one content entity per promotion (instead of 2 like in 1.x). We need to profile the order refresh process, and see what the speed is for loading (and evaluating) 10, 50, 100, 300 promotions.
We should then see if we would benefit from caching promotions (one entry per store & order type). How many promotions can we fit in 1mb? Is the fetch faster enough to make a difference? Remains to be seen.

Comments

bojanz created an issue. See original summary.

bojanz’s picture

Status: Active » Closed (duplicate)

Continued in #2894752: Optimize PromotionStorage->loadAvailable which is more specific.

bojanz’s picture

Title: Investigate promotion optimizations » Investigate caching promotions by store / order type
Status: Closed (duplicate) » Active

Actually, let's keep this open for now, since the approach is more about caching than optimizing loading.