This version is all about performance
CodeCop was fast enough already for a live method interception library. We didn’t had any customers complaining about speed, nor the community is calling us snails either. The thing is, we’re just very demanding towards performance, so we did one of our biggest internal refactorings ever, we radically changed the way we generate runtime metadata.
A little secret on Metadata
Up to now, in case you hadn’t already noticed, upon bootstrap, CodeCop had to disguise itself as a “profiler” for a few seconds, just to “trick” the CLR and be able to inject runtime metadata onto the intercepted app’s metadata tables.
These were just a few quick snapshots as we don’t use the Profiling API for IL rewriting but it was sufficient to degrade the performance a bit and to be honest with you I always thought of it as our Achilles heel.
Bye, Bye Profiler disguise
I’m SO proud to be able to tell you that we’ve eliminated the need to “fool” the CLR with a “profiler costume”. We’ve been able to use the CLR metadata APIs directly on our code (no wonder why John Sonmez calls me .NET breaker).
This simple action, but fairly complex on its wire-up process brought us insane speed gains. Remember the 1000 method interception video in 6.7 secs? Let’s challenge that right now.
Well, here’s the screenshot of the same exact app intercepting live 1000 methods:
Do I need to say more? 🙂
Speaking of challenges
Contribute to our community, build interceptors or any kind of cool stuff that makes use of CodeCop and ping us, we will send you those goodies right away, so hurry up!
Until next time and here’s the keys to your new method interception Ferrari.