Alex Ferguson <[EMAIL PROTECTED]> writes:

> Is pattern-matching short strings (one or two characters) likely to be
> _vastly_ less efficient than matching against a single level of
> constructor?  (Order of magnitude, plus.)  Trying to make sense of some
> profiling numbers, here...

Quite possibly - pattern matching on strings involves building a
dictionary for Eq [Char], unpacking the string (it's represented as
packed in the object code), and performing the comparison.  This is
probably bad. 

Try replacing 

        f "aa" = ...

with

        f ('a':'a':[]) = ...

Cheers,
        Simon

-- 
Simon Marlow                                             [EMAIL PROTECTED]
University of Glasgow                       http://www.dcs.gla.ac.uk/~simonm/
finger for PGP public key

Reply via email to