C
C#10mo ago
TheBoxyBear

✅ Release slower than Debug

I'm doing some benchmarks on two async methods and strangely for both, they consistently have twice the execution time on Release vs Debug. I have the default project settings regarding configurations and sadly I can't share the code but I'd like some clues at what could cause such issues in general as I couldn't find much info
11 Replies
Omnissiah
Omnissiah10mo ago
sorry if i ask, but did you do a serious benchmark or a jerry rigged benchmark?
TheBoxyBear
TheBoxyBearOP10mo ago
Just Stopwatch but the results are very consistent
Mayor McCheese
Mayor McCheese10mo ago
Are you sure you're properly isolated? You might have a cold start issue somewhere
TheBoxyBear
TheBoxyBearOP10mo ago
Like some caching from having ran Debug more than Release? I'll try cold start on a different machine to be sure
Mayor McCheese
Mayor McCheese10mo ago
Not so much that But proper benchmarks are going to warm things up, etc
TheBoxyBear
TheBoxyBearOP10mo ago
Trying now with BenchmarkDotNet
Omnissiah
Omnissiah10mo ago
is this microbenchmarking, like in nano/micro, or like seconds?
Mayor McCheese
Mayor McCheese10mo ago
Depends on how some things are laid out too from a lazy assembly load perspective
TheBoxyBear
TheBoxyBearOP10mo ago
Kinda unfortunate though as the line of acceptable performance in this case sits right in between what I'm getting in both scenarios
Mayor McCheese
Mayor McCheese10mo ago
Are you executing just once?
TheBoxyBear
TheBoxyBearOP10mo ago
yeah, reworking it for a more robust benchmark now .... actually realizing running more than once isn't possible :NotLikeThis: Anyway can't really share more details but thanks for the tips Adjusted to support multiple runs and indeed it seems to be a coldboot issue. After 10 runs the runtime decreases tehfold :Stonks:
Want results from more Discord servers?
Add your server