Text this: Automatic code optimization for computing the McCaskill partition functions