C
C#4mo 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
WEIRD FLEX
WEIRD FLEX4mo ago
sorry if i ask, but did you do a serious benchmark or a jerry rigged benchmark?
TheBoxyBear
TheBoxyBear4mo ago
Just Stopwatch but the results are very consistent
Mayor McCheese
Mayor McCheese4mo ago
Are you sure you're properly isolated? You might have a cold start issue somewhere
TheBoxyBear
TheBoxyBear4mo 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 McCheese4mo ago
Not so much that But proper benchmarks are going to warm things up, etc
TheBoxyBear
TheBoxyBear4mo ago
Trying now with BenchmarkDotNet
WEIRD FLEX
WEIRD FLEX4mo ago
is this microbenchmarking, like in nano/micro, or like seconds?
Mayor McCheese
Mayor McCheese4mo ago
Depends on how some things are laid out too from a lazy assembly load perspective
TheBoxyBear
TheBoxyBear4mo 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 McCheese4mo ago
Are you executing just once?
TheBoxyBear
TheBoxyBear4mo 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
More Posts