Jump to navigation

Poupou's Corner of the Web

Looking for perfect security? Try a wireless brick.
Otherwise you may find some unperfect stuff here...


There are still great GSoC opportunities left!

but a little story first...

A few weeks ago I wanted to optimize, i.e. turn off, some Gendarme rules based on whether a module holds, or not, a member reference to some method. In doing so I needed to compare a lot of MemberReference but it turns out that they are re-computed (either with String.Concat or StringBuilder) each time.

I suspected this was slowing down Gendarme a bit and would even more with the change I had in mind. My first reflex was suggesting to JB to cache those values inside Cecil. He reminded me that since Cecil can write assemblies (a fact I'm quick to forget ;-) caching those value is not simple.

Nevertheless I had some ideas to try. But before trying anything I decided to create a baseline, i.e. how much memory Gendarme allocated to analyze all of Mono's 2.0 assemblies (805573 KB). The next logical step was to see how much my idea would save (or not) but I got curious and looked into my baseline log file...

It was not long before I found some stuff that looked out of the ordinary. From unrequired boxing in struct operators (about 3MB) in Cecil and a lot of (avoidable) MonoType.ToString (about 16MB) inside Gendarme. At that stage I had forgotten my original idea and continued looking at the biggest allocations going on... to the point where I found that reusing Hashtable inside ReadCilBody could save, alone, 10% of the allocated memory.

Final score: 686069 KB, so 15% less memory needs to be allocated (and tracked and freed). Since all, but one, changes are inside Cecil a lot of applications should benefit from them (at least once they update from SVN or when the next Mono version is released). The only negative aspect is that I still don't know if my idea was good or not ;-(

back to our original subject...

The funny things is that this blog is very typical. Optimizations, either for higher performance or lowering memory requirements, are common and often blogged about (probably since the results are easily expressed in numbers). It's also the most replied to subject in the mailing-list too.

So I find it strange to there has not been any GSoC proposal for those projects:
Summer of Profiling
Gendarme: Statistics and Performance Analysis
or any other similar proposal from students - as there are many ways to "articulate" such a proposal.

If I could save 15% on a weekend how much could you save in a summer ?

3/31/2008 10:13:00 | Comments

The views expressed on this website/weblog are mine alone and do not necessarily reflect the views of my employer.