
#13360: Add a flag to enable inferring HasCallStack constraints -------------------------------------+------------------------------------- Reporter: gridaphobe | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by saurabhnanda):
These two versions should perform the same, do they?
They seem to be performing almost the same (benchmarks are called `explicit callstack` below) -- in fact, the explicitly managed callstack is performing slightly worse.
Next I would try shrinking the contents of the user-level CallStack
This seems to be the **biggest cost** (benchmarks are called `explicit callstack (mini)` below. In fact, with the "minified contents" the perf- penalty is **~1.2x vis-a-vis ~3-4x** in the regular callstack. [https://github.com/vacationlabs/hascallstack- benchmarks/blob/7e32c2d95f6fd82b0afbf0436a895f9edf1913e0/app/Main.hs: Benchmark code] {{{ benchmarking recur/no callstack/10 time 837.4 ns (826.7 ns .. 850.3 ns) 0.999 R² (0.998 R² .. 1.000 R²) mean 829.8 ns (824.7 ns .. 838.4 ns) std dev 20.68 ns (11.06 ns .. 33.00 ns) variance introduced by outliers: 33% (moderately inflated) benchmarking recur/HasCallStack/10 time 2.773 μs (2.763 μs .. 2.787 μs) 0.999 R² (0.999 R² .. 1.000 R²) mean 2.797 μs (2.775 μs .. 2.846 μs) std dev 105.8 ns (38.93 ns .. 174.7 ns) variance introduced by outliers: 50% (severely inflated) benchmarking recur/explicit callstack/10 time 4.103 μs (4.086 μs .. 4.131 μs) 1.000 R² (0.999 R² .. 1.000 R²) mean 4.147 μs (4.114 μs .. 4.210 μs) std dev 157.9 ns (107.7 ns .. 233.9 ns) variance introduced by outliers: 50% (moderately inflated) benchmarking recur/explicit callstack (mini)/10 time 1.027 μs (1.024 μs .. 1.031 μs) 1.000 R² (0.999 R² .. 1.000 R²) mean 1.048 μs (1.037 μs .. 1.068 μs) std dev 52.87 ns (35.62 ns .. 76.73 ns) variance introduced by outliers: 67% (severely inflated) benchmarking recur/no callstack/100 time 8.290 μs (7.961 μs .. 8.558 μs) 0.995 R² (0.993 R² .. 1.000 R²) mean 8.061 μs (7.992 μs .. 8.224 μs) std dev 312.9 ns (154.9 ns .. 482.3 ns) variance introduced by outliers: 48% (moderately inflated) benchmarking recur/HasCallStack/100 time 32.06 μs (31.89 μs .. 32.23 μs) 1.000 R² (0.999 R² .. 1.000 R²) mean 32.05 μs (31.96 μs .. 32.17 μs) std dev 368.3 ns (299.5 ns .. 449.9 ns) benchmarking recur/explicit callstack/100 time 48.52 μs (47.12 μs .. 49.92 μs) 0.997 R² (0.995 R² .. 1.000 R²) mean 47.70 μs (47.39 μs .. 48.28 μs) std dev 1.334 μs (750.2 ns .. 2.156 μs) variance introduced by outliers: 28% (moderately inflated) benchmarking recur/explicit callstack (mini)/100 time 9.225 μs (9.111 μs .. 9.423 μs) 0.998 R² (0.996 R² .. 1.000 R²) mean 9.188 μs (9.121 μs .. 9.306 μs) std dev 291.6 ns (160.9 ns .. 459.9 ns) variance introduced by outliers: 38% (moderately inflated) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13360#comment:24 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler