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...

Weblog

Gendarme Performance

Most of the recent Gendarme framework API changes were made to simplify writing rule and/or make them easier to read (and review). However some also had slight motivations to help performance, either by reducing memory allocations or by reducing the number of times a rule needs to be called.

So, with those changes, I anticipated slightly better performance from the previous version. Running the default rule set of Mono's mscorlib.dll 2.0 takes:

  • 56.881992 seconds for 0.0.5.0 (the version that will ship with Mono 1.9); and
  • 55.303419 seconds for 0.1.0.0 (SVN HEAD).

Not a big, or even significant, difference. However 0.1.0.0 has seven (7) more rules than 0.0.5 and also loads debugging information (mdb for Mono) to report source files and line numbers for defects. So, considering the extra work, it seems we negated the impact of those new features.

Another new feature, the AssemblyResolver can also takes a big toll since it will likely load all referenced assemblies. This doesn't show on the previous results (on purpose) since mscorlib.dll doesn't reference any other assembly. However almost all other existing assemblies have references.

So to see the impact on a large code base, I executed the default set on the 70 assemblies provided by Mono's 2.0 profiles. Results are:

  • 422.813083 seconds for 0.0.5.0
  • 441.197703 seconds for 0.1.0.0

So a bit more time than before. Yet this is still very approximate since some rules don't yet take fully advantages of the API changes. E.g. rules are now able to turn themselves off if they can't be used (e.g. checking for a 2.0 specific problem on a 1.x assembly). Another example, where more time would be required, is that rules can now work on the assembly set (find problem across several assemblies) and not just on individual assemblies.

If any of this got your interest then there might be a student task waiting for someone like you!


2/20/2008 23:04:40 | Comments

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