[SLOF] [PATCH] base: increase catpad buffer

Segher Boessenkool segher at kernel.crashing.org
Tue Nov 28 19:25:11 AEDT 2017


On Tue, Nov 28, 2017 at 01:08:09PM +0530, Nikunj A Dadhania wrote:
> Current buffer of 1K is not sufficient, and causes exception if more than 20
> devices are used with bootindex. Increase the buffer size to 16K

Concatenating many strings this way is quadratic in the total length,
which is very painful with 1k already but ridiculously slow with 16k.
Use a better method?  $cat is a nice simple lazy utility word, it is
not good for constructing unbounded lists.


Segher


> diff --git a/slof/fs/base.fs b/slof/fs/base.fs
> index edd474e..b885d28 100644
> --- a/slof/fs/base.fs
> +++ b/slof/fs/base.fs
> @@ -53,7 +53,7 @@ VARIABLE mask -1 mask !
>  ;
>  
>  
> -CREATE $catpad 400 allot
> +CREATE $catpad 4000 allot
>  : $cat ( str1 len1 str2 len2 -- str3 len3 )
>     >r >r dup >r $catpad swap move
>     r> dup $catpad + r> swap r@ move


More information about the SLOF mailing list