"Will obfuscation slow my app down?" is one of the most common questions, and the honest answer is: it depends entirely on which layer, and where you apply it. Most of them cost nothing you can measure. One of them costs a lot — on purpose — and is the one to aim carefully.
Layer by layer
| Layer | Runtime cost | Size cost |
|---|---|---|
| Symbol renaming | None | Slightly smaller, if anything |
| Block ILDasm | None | None |
| String encryption | Negligible | Tiny (a decoder) |
| Control-flow obfuscation | Small | Larger methods |
| Reference proxying | Small (extra indirection) | Small |
| Method virtualization | Large | Fixed interpreter + bytecode |
The layers you can ignore
Renaming only changes names in metadata. The JIT compiles the same IL to the same native code; shorter names can even make the assembly marginally smaller. There is no runtime cost, which is why it is the free default.
String encryption replaces a constant load with a function call that decodes the value. Measured against anything your program actually does with that string — write it to a log, put it in a request, show it on screen — the decode is lost in the noise. The only theoretical concern is a literal pulled millions of times inside a hot loop, and the fix there (hoist it into a field once) is good practice anyway. See how string encryption works.
The layers to apply with a little thought
Control-flow obfuscation adds instructions and branches, so a transformed method is larger and slightly slower. For ordinary code — event handlers, business logic, UI — this is imperceptible. The place to think about it is genuinely hot code: a tight numeric loop run billions of times will feel extra branches. The answer is not to avoid the layer but to avoid applying it to that method. How control-flow obfuscation works explains what it changes.
Reference proxying routes external calls through a small indirection. One extra hop per proxied call — invisible almost everywhere, worth keeping off the hottest paths.
The layer that is genuinely expensive
Method virtualization is different in kind. A virtualized method no longer runs as JIT-compiled native code — it runs through an interpreter, instruction by instruction. That is often several times slower, sometimes more, and it is unavoidable because the slowness is the protection: the attacker has to go through the same interpreter you do.
This makes placement everything. Virtualization is perfect for code that runs rarely
and matters a lot — a licence check at startup, an activation routine, a one-shot
calculation. It is the wrong tool for anything in a render loop, a per-frame update, a
request hot path or a tight numeric kernel. Because it is opt-in per method with a
[Virtualize] attribute, you have exact control — use it. Details and
trade-offs are in what method
virtualization is.
Measure your own case
General guidance only goes so far; your workload is specific. If performance is a concern, benchmark the path that matters before and after, the same way you would for any other change. In practice almost everyone finds the common layers free and reserves virtualization for exactly the few methods where a few extra microseconds at startup buys protection worth having. You can obfuscate a build and profile it against your original in the time it takes to read this page.