From: Claes W. <kl...@ta...> - 2006-11-27 20:31:00
|
Luke Gorrie wrote: > Howdy! > > The version of yaws_api:htmlize/1 in CVS uses binaries for its > accumulator when the input is a binary and this blows the (R9) > emulator's heap on a decent-sized input due to bad GC behaviour. > > Here's a version that doesn't have the problem: > > %% htmlize > htmlize(Bin) when binary(Bin) -> > list_to_binary(htmlize_l(binary_to_list(Bin))); > htmlize(List) when list(List) -> > htmlize_l(List). > Yeah, current code looks like: %% htmlize htmlize(<<Char, Tail/binary>>) -> case htmlize_char(Char) of Char -> <<Char, (htmlize(Tail))/binary>>; Bin -> <<Bin/binary, (htmlize(Tail))/binary>> end; htmlize(<<>>) -> <<>>; htmlize(List) when list(List) -> htmlize_l(List). I don't think the R11's work especially well with that code either ... Hmmmm, what's really missing is a lot of builtin binary functions, such as bin_map(Fun, Binary), bin_re_match() bin_x ... I changed CVS /klacke |