Andy Massimino wrote:

> The timings are very encouraging.  Is the primary speedup in the function
> parsing or better argument passing?

The main speedup is that instead of parsing each line over and over
again, it is parsed once and turned into instructions which can be
executed quickly.

What also helps a lot is to not store local variables in a dictionary,
but put them on the stack, so they can be accessed directly.

On top of that, the loop to execute lines has necessary overhead, since
it has to take care of anything that might happen in that line, such as
throwing an exception.

> We have lambdas to write filter and map statements but for performance
> critical applications it's still much faster to use an eval string instead
> due to the function call overhead.  (I.e. map(a, 'v:val > 5') is faster
> than map(a, {k,v->v>5}).

That is because of the overhead of calling a function.  It has to create
the dictionaries for a: and l:, and several other things to handle
whatever may happen in the function.  With the new way calling a
function will still have some overhead (creating a stack frame) but it's
much, much less.


-- 
            ### Hiroshima 45, Chernobyl 86, Windows 95 ###

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201912181339.xBIDdOmc016386%40masaka.moolenaar.net.

Raspunde prin e-mail lui