vim's join() don't growup memories by proportional of size of the list.
So if you edit f_join() in 'eval.c', it will be fast. see number '80'.
---------------
static void
f_join(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
garray_T ga;
char_u *sep;
if (argvars[0].v_type != VAR_LIST)
{
EMSG(_(e_listreq));
return;
}
if (argvars[0].vval.v_list == NULL)
return;
if (argvars[1].v_type == VAR_UNKNOWN)
sep = (char_u *)" ";
else
sep = get_tv_string_chk(&argvars[1]);
rettv->v_type = VAR_STRING;
if (sep != NULL)
{
ga_init2(&ga, (int)sizeof(char), 80);
list_join(&ga, argvars[0].vval.v_list, sep, TRUE, 0);
ga_append(&ga, NUL);
rettv->vval.v_string = (char_u *)ga.ga_data;
}
else
rettv->vval.v_string = NULL;
}
---------------
For example, I changed 80 to 2000. And call join() with list that have 2000
items.
original: 0.035153
patched: 0.003007
I'm thinking that list_join() shouldn't use ga_xxx functions.
--
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