[Haskell-cafe] Re: Yet another binary reader (10x faster thanHackage's binary; )

Dr.Koster drkoster at qq.com
Wed Mar 20 06:20:08 UTC 2019


These two assumptions are basically the most challenging issues stop people from getting more performance, e.g. If somehow you want to support incremental parsing, a primitive like `ensureN` probably need to do something like


```
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.


Regards
Han Dong




------------------ 原始邮件 ------------------
发件人: "Joachim Durchholz"<jo at durchholz.org>;
发送时间: 2019年3月20日(星期三) 中午1:28
收件人: "haskell-cafe"<haskell-cafe at haskell.org>;

主题: 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-cafe
Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20190320/2aec4044/attachment.html>


More information about the Haskell-Cafe mailing list