vim-jp/issues — Issue #126: join()が遅い
Author: mattn
Created: 2012-01-12 07:27:46+00:00
State: open

らしい。

https://groups.google.com/d/msg/vim_dev/WCwNEgJXlb4/Wh3D59HDfuMJ

ここからのくだり。

```c
/*
* "join()" function
*/
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;
}
```

リストのサイズが予め分かってるのに、なぜに80 www