better speed comparison code for L0 EM alg