Yasuhiro Matsumoto wrote:
> Hi all.
>
> Joining lines by backslash in Vim scripts are bits slow.
> Currently, it call alloc/strcpy/strcat/free in each lines.
>
> let foo = "foooo"
> \. "foooo"
> \. "foooo"
>
> It should use ga_init2/ga_concat.
>
> Patch is here: https://gist.github.com/1598921
>
> Below is a benchmark result.
>
> --------------------------------
> foo.log
> =======
>
> 2000 operations of joining 4 lines. and 1 operation of joining 2000 lines.
>
> https://raw.github.com/mattn/vimjp-issue-123/master/foo.vim
>
> |original| patched| %|
> |--------|--------|-----|
> |0.578287|0.284685| 49.2|
> |0.575204|0.284810| 49.5|
> |0.577512|0.284540| 49.2|
>
> bar.log
> =======
>
> 12000 operations of joining two lines.
>
> https://raw.github.com/mattn/vimjp-issue-123/master/bar.vim
>
> |original| patched| %|
> |--------|--------|-----|
> |0.070951|0.071277|100.4|
> |0.070916|0.071782|101.2|
> |0.071404|0.071338| 99.9|
>
> baz.log
> =======
>
> 10000 operations of no joinings.
>
> https://raw.github.com/mattn/vimjp-issue-123/master/baz.vim
>
> |original| patched| %|
> |--------|--------|-----|
> |0.045680|0.045479| 99.5|
> |0.046300|0.045368| 97.9|
> |0.045338|0.045529|100.4|
>
> --------------------------------
That sounds like a nice improvement. Can you fix the indenting in the
patch?
--
[The rest of the ARMY stand around looking at a loss.]
INSPECTOR END OF FILM: (picks up megaphone) All right! Clear off! Go on!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- 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