-
-
Save int-index/38af0c5dd801088dc1de59eca4e55df4 to your computer and use it in GitHub Desktop.
Arrows.hs Measurements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE Arrows #-} | |
import Control.Arrow (returnA) | |
f :: () -> () | |
f = | |
proc () -> | |
let _ = () in | |
let _ = () in | |
let _ = () in | |
let _ = () in | |
-- and then on line 284168 | |
returnA -< () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Command: | |
$ inplace/bin/ghc-stage2 -ddump-timings ~/Arrows.hs | |
Measurements: | |
master | |
Parser [Main]: alloc=9560778976 time=7956.168 | |
Parser [Main]: alloc=9560778976 time=7911.255 | |
Parser [Main]: alloc=9560778976 time=7978.155 | |
Parser [Main]: alloc=9560778976 time=8072.056 | |
Parser [Main]: alloc=9560778976 time=7867.061 | |
wip/exp-pat-frame (deep embedding) | |
Parser [Main]: alloc=9574418648 time=8050.242 | |
Parser [Main]: alloc=9574418648 time=7928.873 | |
Parser [Main]: alloc=9574418648 time=7896.294 | |
Parser [Main]: alloc=9574418648 time=7917.393 | |
Parser [Main]: alloc=9574418648 time=7840.901 | |
wip/exp-cmd-frame (shallow embedding, without --coerce) | |
Parser [Main]: alloc=9899586040 time=8769.317 | |
Parser [Main]: alloc=9899586040 time=8843.270 | |
Parser [Main]: alloc=9899586040 time=8698.141 | |
Parser [Main]: alloc=9899586040 time=8757.309 | |
Parser [Main]: alloc=9899586040 time=8771.368 | |
wip/exp-cmd-frame (shallow embedding, with --coerce) | |
Parser [Main]: alloc=9706356832 time=7963.211 | |
Parser [Main]: alloc=9706356832 time=8002.884 | |
Parser [Main]: alloc=9706356832 time=8085.704 | |
Parser [Main]: alloc=9706356832 time=8042.423 | |
Parser [Main]: alloc=9706356832 time=8007.699 |
Using a GADT instead of a CPS encoding in the shallow embedding had no effect: time spent is still approximately equal to that in master
:
master
:Parser [Main]: alloc=9560778976 time=8090.421
wip/exp-pat-frame
:Parser [Main]: alloc=9574418648 time=7921.118
wip/exp-cmd-frame
:Parser [Main]: alloc=9679077216 time=8006.478
Allocations are apparently slightly reduced.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NB. Thermal throttling of my CPU seemed to have an effect on the execution time, changing the results by up to 1500 units. The performance numbers were much worse right after a full rebuild (in the ballpark of 9500).
When interleaving tests for
master
,wip/exp-pat-frame
(deep embedding), andwip/exp-cmd-frame (shallow embedding
(with--coerce
), I observe very similar numbers:master
:Parser [Main]: alloc=9560778976 time=7973.300
wip/exp-pat-frame
:Parser [Main]: alloc=9574418648 time=7878.008
wip/exp-cmd-frame
:Parser [Main]: alloc=9706356832 time=7957.351
It is therefore safe to conclude that neither of the approaches has any significant impact on parsing performance. Omitting
--coerce
has some negative performance impact, about 10%.