Ampelofilosofies

homeaboutrss
The mind is like a parachute. If it doesn't open, you're meat.

rake performance: check the mirror

08 Jun 2011

At work we have a few catch phrases we use when we want to identify certain complex situations. Things like “boys, we have a Houston”, “you broke my build” and my favorite “the problem sits in front of the computer”.

That last one perfectly describes the final chapter in the battle to improve performance of our build system (for previous skirmishes check here and here first).

It turned out to be extremely simple. To be exact it was a three character change. Actually the same character from three places very very close to each other.

We have a somewhat deep directory structure for our C code, something like src/product/type/platform/layer/component.

Now in order to get the sources, say per component, you can do something like this: FileList["src/product/**/layer/component/*.c"].

Well, don’t. The recursive wildcard will take ‘layer/component’ and run with it down the whole ‘src/product’ tree. Wanna see how bad this gets? Here are the numbers once this particular stroke of brilliance is removed from the codebase:

Cluster 5 is a full build, clusters 7/8 and 9/10 are IDE project generation tasks (full and incremental). We got a 59% performance boost on full builds and whopping 90% boost for IDE project generation. And all that by changing 3 characters!

So, one more thing for the things-you-shouldn’t-do-with-rake list:

  • Don’t do FileList["src/bla/**/smthg/smthg/foo/bar/*.c"]

blog comments powered by Disqus