Posterous theme by Cory Watilo

refac_lines

Introducing refac_lines.

Refactoring common output (using something like LCS as the base; i.e., difflib in Python) and then creating an index...is pretty helpful for analyzing large builds. An example is included using a snippet of the make output from the Chromium Embedded Framework.

Cef_snippet

If you think about it, most of 'intelligence' (a la Jeff Hawkins) is about deducing patterns and formulating parse trees in your mind.

The idea is pretty key. This script is not particularly pretty. JS and CSS should be added and it should be rewritten. But don't currently have the time / need. Others might though.... You can actually deduce the 'structure' of pretty much anything with that or a similar approach.

quickfix (vim) python

Put this in your path as 'efm_filter.py':

And this two-line file as 'rev_python':

#!/bin/bash
python $* 2>&1 | efm_filter.py

And this in, e.g., ~/.vim/ftplugin/python/python.vim (or use autocommand hooks):

set errorformat+=
    \%A\ \ File\ \"%f\"\\\,\ line\ %l\\\,%m,
    \%C\ \ \ \ %.%#,
    \%Z,
    \%-G%.%#

set makeprg=rev_python\ %

Via reading :errorformat closely and thinking about the differences between what most compilers output and what python errors on. The errorformat scanf language is a fun little hobby of a DSL.

[1]+ Done

It's funny how people affect lives. 

I suspect little bits of what Steve Jobs meant will reappear over time, now and then. I'm waiting to get my oil change / 20,000 mile maintenance done. Listening to Young the Giant, and observing this peculiar mother and daugther -- no doubt also waiting for a maintenance appointment.

They're playing on the mother's iPhone. Probably some sort of kid's game.

Analyzing large builds (e.g., chromium on a Mac)

Run your build (e.g., using gbuild, gyp, etc.) from the command line and pipe all the output to a file (somewhat like http://tmsh.posterous.com/hackers-guide-to-porting-an-autotools-build-t ). Then analyze it by dividing the build output into sections, and analyzing how the parameters for compiling each src code file (.cc and .cpp, in this case) vary from line to line. This is a sort of crude quick version. But the main thing to note is that we're taking advantage of the dependencies already built into the build system (gyp). So we know the dependencies come first, etc. And we also have a list now of only the files that we need for the Mac build. Not terribly hard to port this to a custom makefile-based build (with ccache, etc., or something a little simpler, and less edge-case handling for all platforms (and not necessarily dependent on xcodebuild), for hacking purposes).

And sample output: