
I just discovered that changing DiffArray to a plain Array improves performance of my code by almost a factor of 10. Bitten by DiffArray yet again! John -- this is no good, just change DiffArray to Array.
update :: (Char -> [Int]) -> DiffArray Int ModP -> Char -> DiffArray Int ModP update lookup arr c = arr // (map calc . lookup $ c) where calc i = (i, (arr ! i) + (arr ! (i-1)))

Am Sonntag 06 September 2009 13:36:57 schrieb John Lato:
I just discovered that changing DiffArray to a plain Array improves performance of my code by almost a factor of 10. Bitten by DiffArray yet again!
That's strange. Compiled without optimisations, using plain Array instead of DiffArray gives a speedup factor of about 38 here, with optimisations it's a factor of 100 (thus it's about on par with the list-only version of the same algorithm).
John

On Sun, Sep 6, 2009 at 4:30 PM, Daniel Fischer
Am Sonntag 06 September 2009 13:36:57 schrieb John Lato:
I just discovered that changing DiffArray to a plain Array improves performance of my code by almost a factor of 10. Bitten by DiffArray yet again!
That's strange. Compiled without optimisations, using plain Array instead of DiffArray gives a speedup factor of about 38 here, with optimisations it's a factor of 100 (thus it's about on par with the list-only version of the same algorithm).
My mistake; I misread the time output. My results are the same as yours.
participants (2)
-
Daniel Fischer
-
John Lato