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?

Joe Phillips
  • 49,743
  • 32
  • 103
  • 159
  • 3
    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. – Jeroen Mostert Apr 30 '18 at 21:31
  • I've seen that a million times and it never clicked. Nice – Joe Phillips Apr 30 '18 at 21:40
  • 3
    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. – Jeroen Mostert Apr 30 '18 at 21:45
  • 1
    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 `nop`s or not – pinkfloydx33 Apr 30 '18 at 22:20

1 Answers1

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

RB.
  • 36,301
  • 12
  • 91
  • 131