Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perf regression for cabal repl -b <package> 3.10.1.0 #9005

Closed
fendor opened this issue Jun 6, 2023 · 6 comments
Closed

Perf regression for cabal repl -b <package> 3.10.1.0 #9005

fendor opened this issue Jun 6, 2023 · 6 comments

Comments

@fendor
Copy link
Collaborator

fendor commented Jun 6, 2023

Describe the bug

The repl feature to open an interactive ghci session with some packages installed has a serious performance regression for 3.10.1.0.
Let's compare the versions, all executed with GHC 9.4.5.

Note, the ':q' is to immediately leave the session again.

> time cabal-3.6.2.0 repl -b directory
:q
Resolving dependencies...
Build profile: -w ghc-9.4.5 -O1
In order, the following will be built (use -v for more details):
 - fake-package-0 (lib) (first run)
Configuring library for fake-package-0..
Preprocessing library for fake-package-0..
Warning: No exposed modules
GHCi, version 9.4.5: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /tmp/cabal-repl.-106795/setcwd.ghci
ghci> :q
Leaving GHCi.

________________________________________________________
Executed in    7.02 secs    fish           external
   usr time    6.53 secs  340.00 micros    6.53 secs
   sys time    0.41 secs  113.00 micros    0.41 secs
> time cabal-3.8.1.0 repl -b directory
:q
Resolving dependencies...
Build profile: -w ghc-9.4.5 -O1
In order, the following will be built (use -v for more details):
 - fake-package-0 (lib) (first run)
Configuring library for fake-package-0..
Warning: No exposed modules
GHCi, version 9.4.5: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /tmp/cabal-repl.-106577/setcwd.ghci
ghci> :q
Leaving GHCi.

________________________________________________________
Executed in    7.16 secs    fish           external
   usr time    6.35 secs    0.00 micros    6.35 secs
   sys time    0.47 secs  357.00 micros    0.47 secs
> time cabal-3.10.1.0 repl -b directory
:q
Resolving dependencies...
Build profile: -w ghc-9.4.5 -O1
In order, the following will be built (use -v for more details):
 - fake-package-0 (lib) (first run)
Configuring library for fake-package-0..
Warning: No exposed modules
GHCi, version 9.4.5: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /tmp/cabal-repl.-107009/setcwd.ghci
ghci> :q
Leaving GHCi.

________________________________________________________
Executed in   15.77 secs    fish           external
   usr time   15.05 secs  342.00 micros   15.05 secs
   sys time    0.90 secs   75.00 micros    0.90 secs

Expected behavior

The performance is bad for all versions since there is basically no work to be done, but especially bad for 3.10.1.0.

System information
All cabal versions have been installed via ghcup today (6.6.2023).
GHC 9.4.5

> uname -a
Linux hugin 6.3.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 30 May 2023 13:44:01 +0000 x86_64 GNU/Linux

Additional context
Add any other context about the problem here.

@fendor
Copy link
Collaborator Author

fendor commented Jun 8, 2023

Perf regression also for cabal-head commit (a191f0a)

> time ~/bin/cabal repl -b directory
:q
Resolving dependencies...
Build profile: -w ghc-9.4.5 -O1
In order, the following will be built (use -v for more details):
 - fake-package-0 (interactive) (lib) (first run)
Configuring library for fake-package-0...
Warning: No exposed modules
GHCi, version 9.4.5: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /tmp/cabal-repl.-249389/setcwd.ghci
ghci> :q
Leaving GHCi.

________________________________________________________
Executed in   16.18 secs    fish           external
   usr time   15.51 secs  631.00 micros   15.51 secs
   sys time    0.83 secs   88.00 micros    0.83 secs

@ulysses4ever
Copy link
Collaborator

Most likely, we'd need a brave soul who could bisect it.

@ulysses4ever
Copy link
Collaborator

Can't reproduce it: I have exactly the same numbers for cabal 3.10 and 3.6 (both installed with ghcup), see the output below. I also tried it in a fresh CABAL_DIR (one per cabal version) -- no change.

❯ cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.2.0 of the Cabal library 

❯ time cabal repl -b directory --repl-options="-e :q" 
Warning: The package list for 'hackage.haskell.org' is 34 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Build profile: -w ghc-9.6.1 -O1
In order, the following will be built (use -v for more details):
 - fake-package-0 (lib) (first run)
Configuring library for fake-package-0..
Preprocessing library for fake-package-0..
Warning: No exposed modules
GHCi, version 9.6.1: https://www.haskell.org/ghc/  :? for help
ghc-9.6.1: unrecognised flag: -e :q

Usage: For basic information, try the `--help' option.
cabal: repl failed for fake-package-0.


________________________________________________________
Executed in    5.62 secs   fish           external 
   usr time    4.57 secs    0.00 micros    4.57 secs 
   sys time    0.96 secs  796.00 micros    0.96 secs 


[ ^^^ --repl-options doesn't seem to work in 3.6.2 but it quits, as I want it to. ]
[     I see the same time if I :q manually]

❯ ghcup set cabal latest
...

❯ cabal --version
cabal-install version 3.10.1.0
compiled using version 3.10.1.0 of the Cabal library 

❯ time cabal repl -b directory --repl-options="-e :q"                                                               0 (0.414s) < 16:18:56
Warning: The package list for 'hackage.haskell.org' is 34 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Build profile: -w ghc-9.6.1 -O1
In order, the following will be built (use -v for more details):
 - fake-package-0 (lib) (first run)
Configuring library for fake-package-0..
Warning: No exposed modules

________________________________________________________
Executed in    5.06 secs   fish           external 
   usr time    4.05 secs  666.00 micros    4.04 secs 
   sys time    0.89 secs  152.00 micros    0.89 secs 

@fendor
Copy link
Collaborator Author

fendor commented Oct 7, 2023

It is very weird, on my machine, this performance regression happens on almost every command. E.g.

> time cabal-3.6.2.0 v2-exec ghc -- --print-libdir
Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.6.2.0 supports
'ghc' version < 9.4): /home/hugin/.ghcup/bin/ghc is version 9.4.7
Resolving dependencies...
/home/hugin/.ghcup/ghc/9.4.7/lib/ghc-9.4.7/lib

________________________________________________________
Executed in    5.65 secs    fish           external
   usr time    5.48 secs  427.00 micros    5.47 secs
   sys time    0.27 secs  146.00 micros    0.27 secs
> time cabal-3.10.1.0 v2-exec ghc -- --print-libdir
Resolving dependencies...
/home/hugin/.ghcup/ghc/9.4.7/lib/ghc-9.4.7/lib
________________________________________________________
Executed in   15.38 secs    fish           external
   usr time   15.23 secs    0.00 micros   15.23 secs
   sys time    0.78 secs  545.00 micros    0.78 secs

@fendor
Copy link
Collaborator Author

fendor commented Oct 7, 2023

Oh, finally the logs tell me something.

call to pkg-config --modversion on all packages failed. Falling back to
querying pkg-config individually on each package
Running: /usr/bin/pkg-config --modversion wpebackend-fdo-1.0
...

So, this is a manifestation of #8930

@fendor
Copy link
Collaborator Author

fendor commented Oct 7, 2023

Closing in favour of #8930

@fendor fendor closed this as completed Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants