performance optimization as proposed by Douglas Bates on the julia-stats mailing list