[Haskell-cafe] haskell in online contests

Daniel Fischer daniel.is.fischer at web.de
Fri Nov 27 21:11:41 EST 2009


Am Samstag 28 November 2009 02:04:31 schrieb Daniel Fischer:
> Make it
>
> distance orig new = f m n
>
> and no thunks need be written at all in this case.
> Cuts down running time by nearly half :)
>
> I think you could speed it up significantly by calculating the distance
> more lazily.

Yup :D

Timings here:
Your last ByteString code: 128s
That with corrected index calculation: 172s
Correct indices and distance orig new = f m n instead of memf m n: 99s
That and an array for the substitution cost: 64s

String IO, substitution cost array and a suitably lazy break-early distance function: 1.7s
That and a lazier surcharge function: 1.5s
The same with ByteString IO: 1.4s

Yes, I'd say that qualifies as a significant speedup.


More information about the Haskell-Cafe mailing list