ghc-pkg: Batched package unregister takes time linear to the batch size
When started using batched ghc-pkg unregister (implemented in #12637 (closed)) we have noticed that it did not give much time speed improvements. I've created a simple reproduction of that behavior in https://github.com/qrilka/pkg-db-problems (which is a bit of package db abuse of cause as the same package gets registered multiple times with different ids). The last run of that script gave me:
qrilka@qdesktop ~/ws/h/pkg-db-problems $ ./test.sh
Up to date
Reading package info from "dist-newstyle/packagedb/ghc-8.6.3/sample-1.0.0-inplace.conf" ... done.
sample-1.0.0: Warning: haddock-interfaces: /home/qrilka/ws/h/pkg-db-problems/dist-newstyle/build/x86_64-linux/ghc-8.6.3/sample-1.0.0/doc/html/sample/sample.haddock doesn't exist or isn't a file
sample-1.0.0: Warning: haddock-html: /home/qrilka/ws/h/pkg-db-problems/dist-newstyle/build/x86_64-linux/ghc-8.6.3/sample-1.0.0/doc/html/sample doesn't exist or isn't a directory
Unregistering single package:
real 0m0,196s
user 0m0,175s
sys 0m0,020s
Unregistering 15 packages:
real 0m2,471s
user 0m2,340s
sys 0m0,130s
Which clearly shows speed problems.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.6.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |