[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: highlighting-kate is sometimes too heavy


Am Samstag, den 06.03.2010, 18:02 +0100 schrieb Joachim Breitner:
> Both these modules have large lists of keywords. Can you see if maybe
> some little restructuring in your code generator can produce code that
> ghc6 handles more easily? This would help us a lot.

ok, I looked a bit into the issue. The problem seems to be that ghc
wants to inline the list of words passed to pKeyword. If I replace this
list of words by one large string, wrapped in "words", the module
compiles much faster. I’m considering applying this change in Debian for
now, as a work-around.

Looking at your code, you use the list only as a lookup. Wouldn’t it
massively speed up your code (and probably fix the compile times as
well) if you replace any occurence of

> [..]
>  pKeyword arg1 list >>= withAttribute "Something"
> [..]

by two global bindings (to benefit from sharing)
> something_word_set = Data.Set.fromList list
> something_word_set_upper = Data.Set.fromList (map (map toUpper) list)
> [..]
>  pKeyword arg1 something_word_set something_word_set_upper
>                                         >>= withAttribute "Something"
> [..]

And maybe, depending on whether ghc wants to inline the fromList call,
apply a trick similar to the one above to avoid the inlining.


Joachim "nomeata" Breitner
Debian Developer
  nomeata@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nomeata@joachim-breitner.de | http://people.debian.org/~nomeata

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply to: