Julian Seward writes:
> I have a large enumeration type (example prog below) on which I
> have done "deriving Read".  My problem is, the derived read for
> lists of these things runs incredibly slowly, so slowly that it
> useless for reading anything larger than the smallest quantity
> of text.
> 
> I also made my own instance of Read for the data type.  This 
> improves performance by a factor of about 50, both in time, and
> heap allocated.  This is with ghc-2.02 -O on sparc-solaris2.5.
> 
> This is not a bug per se, but I feel that it should be considered
> as such, because it gives unexpectedly poor behaviour for a task
> which one would expect to run reasonably quickly.
> 

The code generated for derived Read instances is straight from the
report (i.e., using `lex' without abandon.). An improvement would be
to catch cases such as BigEnum, with all nullary constructors and use
a less ambitious version of `lex'.

--Sigbjorn

Reply via email to