How does GetDiscountPrices with multiple items work?

Vote:
 

I know GetDiscountPrices can be called with a single item and it evaluates that by creating a virutal cart with only that item in it and then runs the promo engine against that cart, but how does it work when I pass multiple items?

Let's say I pass the method 25 items, does it create 25 carts and run the engine 25 times, thus taking the same amount of time it would take to just call GetDiscountPrices 25 times with each item?

I ask all this becuase we are trying to speed up our search pages where we show up to 25 items at a time and their prices with discounts.

Thanks,

Brian

#208383
Oct 22, 2019 23:11
Vote:
 

Yes, however the cart is created in memory then it would be very fast. GetDiscountedPrices is meant to be used in your scenario. 

#208384
Oct 22, 2019 23:22
Vote:
 

When we dont run the engine its about 3 to 4 seconds faster (1 second to load compared to 4 or 5 seconds to load).

Would you suggest then that we look at all our discount logic instead to try to speed things up? (We have a lot of discounts, 100+ active campaigns.)

Are there any epi tools to see what discounts might be taking too long to evaluate?

#208385
Oct 22, 2019 23:26
Andreas J - Oct 23, 2019 11:23
If you want to measure the performance of promotion evaluations, you could override `PromotionProcessorResolver` and register it in your IoC container. You would then override the method `ResolveForPromotion` and always return a wrapper for the actual promotion processor. The wrapper itself would just have a `Stopwatch` and a call to the actual `Evaluate` method.
Vote:
 

There is no epi-specific tools, but you can use just any good .NET profiler (I personally like dotTrace) to find out with is taking time.

#208386
Oct 22, 2019 23:29
Vote:
 

Okay, thanks Quan.

#208387
Oct 22, 2019 23:30
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.