Re: highlighting-kate is sometimes too heavy
Thanks for these ideas. I'm going to try them, and a few other
things, and see if I can't make h-k faster and lighter.
I'll get back to you.
(My longer term plan involves replacing h-k with a new highlighting
library I've been working on, illuminate, which is about 70X faster --
it uses Alex lexers instead of regexes. But that won't be done for
a while, so it's still worth trying to improve h-k, I think.)
John
+++ Joachim Breitner [Mar 06 10 18:15 ]:
> Hi,
>
> 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.
>
> Greetings,
> Joachim
>
>
> --
> Joachim "nomeata" Breitner
> Debian Developer
> nomeata@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
> JID: nomeata@joachim-breitner.de | http://people.debian.org/~nomeata
Reply to: