Monday, September 15, 2014

Re: Optimizing syntax file for Lauterbach T32 Practice script.

On Mon, Sep 15, 2014 at 6:25 PM, Christian Brabandt <cblists@256bit.org> wrote:
> On Mo, 15 Sep 2014, RedX2501 wrote:
>
>> Hello,
>>
>> I have written a syntax file for the Lauterbach T32 Practice script language.
>>
>> Unfortunately it is very slow. I was wondering if you could give me a few hints on how to optimize it.
>>
>> The main thing with this language is that it has MANY keywords and fixed word combinations.
>>
>> What is the best way to match that?
>>
>> I have attached my current version so you get an idea of what i'm talking about.
>
> I don't know much about syntax writing. However I have a couple of
> ideas, but they need at least Vim 7.4
>
> I believe keywords are much cheaper than using syn match. So you might
> try that. Second, if possible try to avoid assertions, they might slow
> down regex matching considerably, you might however try to restrict the
> assertions by some bytes, this might speed up matching a little (use the
> \@123 version of the atom).
>
> If you have many alternations '\|' like in your syntax script, try to
> force matching using the old engine. I believe this is faster (see :h
> \%#=)
>
> And at last, use the new :syntime command to measure performance and
> figure out, which ones is the most costly regex. So you will be able to
> tune specific patterns better.
>
> Best,
> Christian
> --

Interesting ideas, i discovered the syntime commands right after
writing the email and already tried out a few things.

I modified most of the match to be "\<symbol\.\(opt1\|opt2\)" and that
has helped a lot.

I can't use keywords as they don't accept ".". And for instance
"symbol.addinfo" is only valid like that. "symbol" on its own means
nothing. But for single word commands i might be able to use that.

I don't really understand how you think i can should \< with \@.

One thing i'm not sure on is if "match" matches only on word
boundaries or anywhere in the word. That would remove the need for \<.

Using the old regex engine really helped a lot thank you!

The file is now very usable compared to before!

Thank you!

Any other ideas also regarding better ways of identifying function
calls are still very welcome.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: