diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2021-01-15 13:20:01 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-01-23 21:32:47 -0500 |
commit | b18d9e97252c9dd12f08d3e6f56bfec6a6d2469a (patch) | |
tree | d8faaf0c46cc4477b5a07f186785d6d7dfaf325e /rts/win32/MIOManager.h | |
parent | 8ec6d62aa58ad6f226317696a74fea7756694a4a (diff) | |
download | haskell-b18d9e97252c9dd12f08d3e6f56bfec6a6d2469a.tar.gz |
CoreToStg.Prep: Speculative evaluation
From `Note [Speculative evaluation]`:
Since call-by-value is much cheaper than call-by-need, we case-bind
arguments that are either
1. Strictly evaluated anyway, according to the StrictSig of the
callee, or
2. ok-for-spec, according to 'exprOkForSpeculation'
While (1) is a no-brainer and always beneficial, (2) is a bit
more subtle, as the careful haddock for 'exprOkForSpeculation'
points out. Still, by case-binding the argument we don't need
to allocate a thunk for it, whose closure must be retained as
long as the callee might evaluate it. And if it is evaluated on
most code paths anyway, we get to turn the unknown eval in the
callee into a known call at the call site.
NoFib Results:
```
--------------------------------------------------------------------------------
Program Allocs Instrs
--------------------------------------------------------------------------------
ansi -9.4% -10.4%
maillist -0.1% -0.1%
paraffins -0.7% -0.5%
scc -0.0% +0.1%
treejoin -0.0% -0.1%
--------------------------------------------------------------------------------
Min -9.4% -10.4%
Max 0.0% +0.1%
Geometric Mean -0.1% -0.1%
```
Fixes #19224.
Diffstat (limited to 'rts/win32/MIOManager.h')
0 files changed, 0 insertions, 0 deletions