Is LINQPad's IL code the optimized version?
Asked Answered
D

1

8

LINQPad has a tab near the results to show the IL of the C# statements you're running. I'm wondering if this is the optimized "Release" version of the code vs. the unoptimized "Debug" build of the code.

Perhaps there is a simple way to check by writing a small code snippet or something?

Divaricate answered 30/4, 2018 at 21:21 Comment(4)
There's a little /o- / /o+ button in the lower right corner that governs optimization. Since the code changes based on whether it's pressed or not, I'm reasonably sure that you can get either flavor that way.Shanonshanta
I've seen that a million times and it never clicked. NiceDivaricate
Tapping random buttons to see what they do: bad idea if you're maintaining a nuclear reactor; good idea to learn more about how your daily programming tools work.Shanonshanta
If the IL has a bunch of nop instructions, it's probably not optimized. Usually inserted in debug builds so that there's an instruction to put breakpoints on. Perhaps not a 100% always true rule, but if there's a ton of them, most likely not optimized. Though I can't say that, I've ever noticed if linq pad inserts a bunch of nops or notAelber
C
9

This is controlled by preferences ("Edit" → "Preferences"), so it's up to you :)

enter image description here

In addition, the preference can be toggled with the keyboard shortcut Shift + Alt + o, or by clicking the "/o-" or "/o+" option in the bottom right of the UI.

enter image description here

Cordova answered 30/4, 2018 at 21:32 Comment(2)
Fantastic. Can you also add the /o- and /o+ note from Jeroen above?Divaricate
@JoePhillips Done.Cordova

© 2022 - 2024 — McMap. All rights reserved.