Red Gate forums :: View topic - The runtime cost of obfuscation
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 6
SmartAssembly 6 forum

The runtime cost of obfuscation

Search in SmartAssembly 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
Morantex



Joined: 20 Nov 2012
Posts: 6

PostPosted: Wed Jun 26, 2013 9:08 pm    Post subject: The runtime cost of obfuscation Reply with quote

I've been running some performance measurements here on code that is obfuscated and comparing it code that is not.

Basically a test client/server is used to stress test a managed networking API - one that is wholly message based (as opposed to primitive sockets and their byte[] blocks).

This code does a lot - custom (v fast) serialization and intelligent buffering, message dismantling/reassembly and so on and a lot of work and extensive profiling has gone into making this very fast.

Several test clients randomly exchange hundreds of thousands of messages with a test server and we look at total per-process CPU against number of messages.

Here is what I am seeing on tests that run for approx 1 minute elapsed time:

Debug build w obfuscation: 75 uS / msg
Release build w obfuscation: 73 uS / msg.
Debug build n obfuscation: 60 uS / msg.
Release build n obfuscation: 50 uS / msg.

Now since RedGate supply both an obfuscator and a profiler - I'd very much like someone to tell me what specific obfuscation choices cause the most runtime CPU penalties.

I could spend hours tweaking various settings but there are numerous assemblies involved here and each one has its own SA project file, and an SA project supports a host of differing choices and combinations for them- so frankly this is a non-starter (I may disable string oriented settings as a quick experiment though).

What's clear here is that obfuscation of release build code can lead to code that runs slower than an ordinary debug build of that code.

In this case it's adding about 50% more CPU cost over the cost of "pure" release build code - and for a high performance API this is a big cost that undermines all of the original profiling effort.

So RedGate - how can you offer a product that helps us speed up code then at the same time offer us another product that slows it down again !

Thanks

Hugh
Back to top
View user's profile Send private message
Morantex



Joined: 20 Nov 2012
Posts: 6

PostPosted: Wed Jun 26, 2013 9:27 pm    Post subject: Reply with quote

UPDATE: Disabling the dynamic proxy option on two of the more relevant assemblies here saw the 73 uS/msg fall to 65 uS/msg. (That is an obfuscated release build) but this is still performing worse than a straightforward debug build.

Hugh
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 594

PostPosted: Fri Jun 28, 2013 12:34 pm    Post subject: Reply with quote

Control-flow obfuscation.

That's the feature that we know causes systematic slow-down.

Empirical evidence suggest level 2 (strictly valid) has least effect.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group