2018-02-22 0:07 GMT+03:00 Jason Felice <jason.m.fel...@gmail.com>:
> I've been thinking about the recent thread about vimscript and performance
> (after optimizing the heck out of a plugin that does a lot of text
> processing), and I'm curious about vim's reparsing of statements in
> functions and while loops and such for each execution.
>
> Is there something about the syntax that prevents caching parses?  Or
> another mechanism?  Or is it just that nobody's stepped up to do this?  Or
> something else, maybe it's not a good idea?

What do you mean by “caching parses”? There is no virtual machine
executing bytecode, no JIT and no AST - there is *nothing* to cache.
To be able to cache something you first need that something to cache,
and this is exactly the problem. As I said I am currently working on
adding all of that (minus JIT as it would be too complex for me) (to
Neovim), but this is done slowly and this is guaranteed to introduce
incompatibilities: e.g.

- Incompatibilities of the latest expressions parser:
https://github.com/ZyX-I/neovim/blob/389e4fc40f8cee4fa7be7f427fea277674bb2d79/src/nvim/viml/parser/expressions.c#L6-L51.
- Extreme example of function definitions that is completely
impossible to parse with a proper parser:
https://github.com/neovim/neovim/issues/425. Note that the same
technique may be used for :if blocks, unlike function definitions I
could theoretically keep `:execute 'if'` support if I was to drop the
idea of parsing `if|cmd|endif` as `if(cmd)` rather then
`if;cmd;endif`, but I do not like the idea.
- Collection of incompatibilities of a first attempt to create a
parser (code from there may be reused, but resulting AST structures
appeared to be too complex and the whole parser was both recursive and
rather limited (e.g. would not be able to provide highlighting)):
https://github.com/neovim/neovim/issues/387.

>
> Thanks,
> -Jason
>
> --
> --
> You received this message from the "vim_dev" 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_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vim_dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui