Profiling Overhead

The tracing part of CodeTrack v1.0.0.7 has been completely rewritten in order to reduce the profiling overhead as much as possible, while still giving you the option to enable certain measurements if you need them.
By doing this the profiling overhead has been greatly reduced. In this post I’ll show you exactly how much faster CodeTrack has become and also what the effects of the different settings are on the overhead.

The Sample Code

For measuring the overhead I just wrote a very simple console app : 

[MethodImpl(MethodImplOptions.NoInlining)]
private static int MethodA()
{
	return 2;
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void MethodB()
{
	for (int i = 0; i < 10000000; i++)
	{
		MethodA();
	}
}
static void Main(string[] args)
{
	Int64 sum = 0;
	Stopwatch tot = Stopwatch.StartNew();
	for (int i = 0; i < 50; i++)
	{
		var sw = Stopwatch.StartNew();
		MethodB();
		sw.Stop();
		sum += sw.ElapsedMilliseconds;
		Console.WriteLine(sw.ElapsedMilliseconds);
	}
	tot.Stop();
	Console.WriteLine("Total: {0}, Inner Sum: {1}", tot.ElapsedMilliseconds, sum);
	Console.ReadLine();
}

Nothing to fancy, as you can see 🙂 It’s just a method being called a gazillion times.

If I run this app I get:

baseline

So you can see that excuting MethodB 1 time takes 945/50 = 18,9 ms. We’ll use this as our baseline.

V1.0.0.7 vs V1.0.0.6

Just to prove I’ve been doing some useful work, let’s trace this with V1.0.0.6:

1006_tracing

Since this took ages, I didn’t wait for the app to finish, but you can see now this takes about 8100 ms per iteration.
If do the same thing with V1.0.0.7 we get:

results_a

That’s 391 ms per iteration (so 20 times faster, not bad 🙂 )

Options, options, options

In the advanced expander in the tracing options you can pick exactly the options you want for your tracing session (A blogpost about the differences will follow soon).

In this summary I’ll show you the same measurement for different settings:

No options enabled: 391ms
Hi resolution: 466ms
Hi resolution + thread cycles: 509ms
Thread cycles: 454ms
Hi resolution + compensation: 565ms
Generics: 786ms
Timeline + Hi resolution: 6903ms

Another (non-free) famous profiler*: 427ms

*I don’t want to start throwing mud here, so I’ m not going to tell which one it is. Live and let live! I just want to prove that CodeTrack has grown and can deliver professional results.

Of course these measurements depend heavily on the kind of code you are executing, but I think it gives you an idea about how performant CodeTrack has got.

cropped-twitter_bg.png

Don’t take my word for it, go get your free copy and check it out for yourself at
www.getcodetrack.com

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s