[Haskell-cafe] Re: Haskell version of Norvig's Python Spelling Corrector

Bryan O'Sullivan bos at serpentine.com
Mon Apr 23 01:34:58 EDT 2007


Bryan O'Sullivan wrote:

> In my profile results, I find that simply converting words to lower case 
> accounts for a whopping 40% of time and allocation (see the attachment 
> for my definition of the train function).
> 
> COST CENTRE                    MODULE                  %time %alloc
> 
> lower                          Spell                    40.5   41.2
> train                          Spell                    26.3   14.3
> mkWords                        Spell                    21.9   24.1

A little more instrumentation says this (using the darcs head of fps 
built with -auto-all):

loopU                          NewData.ByteString.Fusion  25.4   28.8
splitWith                      NewData.ByteString         15.4   17.2
train                          Spell                      10.2    6.1
isNotAlpha                     Spell                       9.4   12.2
compareBytes                   NewData.ByteString          8.8    9.6
compareBytes                   NewData.ByteString.Lazy     7.4    0.4
inlinePerformIO                NewData.ByteString.Base     6.6    0.0

(At Stefan's suggestion, I renamed the modules in fps to NewData.*, in 
order to get around the name clashes when I try to concurrently use fps 
and base.)

	<b


More information about the Haskell-Cafe mailing list