ensureN n = Parser $ \ buf ... k ->
if n < length buf then k buf ...
else partial buf ... k
The k appear twice inside `ensureN` 's both branch, which will stop parsers from getting inline sooner or later since inlining k into both branch will produce exponential amount of code, so instead GHC will allocate k and make a jump, the best we can get is probably to try make it a joint point, so no allocation is needed, but that's the best you can get from argument passing buffers.
------------------ 原始邮件 ------------------
发送时间: 2019年3月20日(星期三) 中午1:28
主题: Re: [Haskell-cafe] Yet another binary reader (10x faster thanHackage's binary; )
Am 19.03.19 um 22:58 schrieb Станислав Черничкин:
> possibly because of inlining of
> specialization magic.
I have seen people validate this kind of assumption, by looking at the
various intermediate representations of code.
If you're after performance, you may want to do that. You may find that
things work differently than expected, with the potential for becoming a
bottleneck when stuff is scaled up (more varied datatypes in the input
stream, or more complex target datatypes, stuff hidden behind "oh I
don't need GC yet", that kind of finding).
Regards,
Jo
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafeOnly members subscribed via the mailman list are allowed to post.