Benchmarking lexical scan during the downsweep for the ImplicitQualifiedImport proposal

Hello all, In the context of https://github.com/ghc-proposals/ghc-proposals/pull/500, I am looking for a strategy to measure the impact of resolving modules dependencies using a lexical scan during the downsweep phase. For example, in this branch: https://gitlab.haskell.org/TristanCacqueray/ghc/-/tree/make-lexical-analysis I've added a tokenizer pass in the GHC.Driver.Make.getPreprocessedImports function, and using `/usr/bin/time -o /dev/stdout -v _build/stage1/bin/ghc compiler/GHC/Tc/TyCl.hs 2> /dev/null` I measure: LexicalAnalysis found 91 qualified name, and lasted: 150msec Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.72 Maximum resident set size (kbytes): 142396 Using a clean build I get: Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.68 Maximum resident set size (kbytes): 140012 Now my question is, how would you measure the time and space cost of such change. For example, what profiling tool would you recommend and how can I test a modified ghc to build ghc itself? Thanks in advance, -Tristan

1. You want to test this in the context of recompilation, that is
where the cost of downsweep is most prominent. Ie, compile all the
modules normally once and then test how long it takes to recompile.
There is already a test in tree which does this
(MultiLayerModulesRecomp).
2. You can build GHC using `--make` mode with an invocation something like..
$GHC -O -hidir $out -odir $out -i$dir -Icompiler
-I_perf/stage1/compiler/build/ -i_perf/stage1/compiler/build/ GHC
-XNoImplicitPrelude -XNoPolyKinds -O
3. The way to extract timing information is to use the `+RTS -s` option.
Matt
On Sun, Aug 28, 2022 at 7:55 PM Tristan Cacqueray
Hello all,
In the context of https://github.com/ghc-proposals/ghc-proposals/pull/500, I am looking for a strategy to measure the impact of resolving modules dependencies using a lexical scan during the downsweep phase.
For example, in this branch: https://gitlab.haskell.org/TristanCacqueray/ghc/-/tree/make-lexical-analysis I've added a tokenizer pass in the GHC.Driver.Make.getPreprocessedImports function, and using `/usr/bin/time -o /dev/stdout -v _build/stage1/bin/ghc compiler/GHC/Tc/TyCl.hs 2> /dev/null` I measure:
LexicalAnalysis found 91 qualified name, and lasted: 150msec Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.72 Maximum resident set size (kbytes): 142396
Using a clean build I get:
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.68 Maximum resident set size (kbytes): 140012
Now my question is, how would you measure the time and space cost of such change. For example, what profiling tool would you recommend and how can I test a modified ghc to build ghc itself?
Thanks in advance, -Tristan _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Thank you Matt, that's exactly what I was looking for. The `--make GHC` command failed because of hidden packages, and adding the list of `-package-id` arguments used by hadrian fixed the errors. For the record, here is the full invocation I got working: https://gitlab.haskell.org/TristanCacqueray/ghc/-/blob/make-lexical-analysis... -Tristan On Mon, Aug 29, 2022 at 10:08 Matthew Pickering wrote:
1. You want to test this in the context of recompilation, that is where the cost of downsweep is most prominent. Ie, compile all the modules normally once and then test how long it takes to recompile. There is already a test in tree which does this (MultiLayerModulesRecomp).
2. You can build GHC using `--make` mode with an invocation something like..
$GHC -O -hidir $out -odir $out -i$dir -Icompiler -I_perf/stage1/compiler/build/ -i_perf/stage1/compiler/build/ GHC -XNoImplicitPrelude -XNoPolyKinds -O
3. The way to extract timing information is to use the `+RTS -s` option.
Matt
On Sun, Aug 28, 2022 at 7:55 PM Tristan Cacqueray
wrote: Hello all,
In the context of https://github.com/ghc-proposals/ghc-proposals/pull/500, I am looking for a strategy to measure the impact of resolving modules dependencies using a lexical scan during the downsweep phase.
For example, in this branch: https://gitlab.haskell.org/TristanCacqueray/ghc/-/tree/make-lexical-analysis I've added a tokenizer pass in the GHC.Driver.Make.getPreprocessedImports function, and using `/usr/bin/time -o /dev/stdout -v _build/stage1/bin/ghc compiler/GHC/Tc/TyCl.hs 2> /dev/null` I measure:
LexicalAnalysis found 91 qualified name, and lasted: 150msec Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.72 Maximum resident set size (kbytes): 142396
Using a clean build I get:
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.68 Maximum resident set size (kbytes): 140012
Now my question is, how would you measure the time and space cost of such change. For example, what profiling tool would you recommend and how can I test a modified ghc to build ghc itself?
Thanks in advance, -Tristan _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
participants (2)
-
Matthew Pickering
-
Tristan Cacqueray