-
Notifications
You must be signed in to change notification settings - Fork 338
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
Improved performance by switching to vector-hashtables
#5966
Comments
Some timings for type-checking and loading the standard library, with several variants of a recent version of Agda (in no case compiled with the flag
What do you think, should we switch from hashtables to vector-hashtables? It is unclear to me how well-maintained the latter package will be in the future, and no Hackage package seems to depend on it. However, the changes involved are small (these hashtables are only used by the serialiser/deserialiser), so it would be easy to switch back in the future. |
What are the lessons learned from your analysis?
|
If hashtables is used. I have already committed such a change, but that requirement is only imposed starting from GHC 9.0.
No.
No. |
I managed to compile Agda, with vector-hashtables, using all versions of GHC that we support. The test suite does not complain. Do you think we should switch? |
The changes in your PR amount to swapping |
This change was suggested by Andreas Abel.
I added |
This change was suggested by Andreas Abel.
vector-hashtables
library
vector-hashtables
libraryvector-hashtables
A performance debugging story:
I noticed that Agda had become slower. I had some benchmark logs from earlier this year lying around, so I knew roughly how fast Agda could be for that benchmark, and a recent version of Agda was significantly slower. However, when I compiled some variants of Agda from around the time of the benchmark logs the program was still slow. Fortunately I had an old, already compiled binary which was fast (compared to the slow ones). That binary did not correspond to any commit on the main branch of Agda, but I could find the commit in my reflog.
When I checked out and compiled that commit Agda was still slow. I had used the same version of GHC in both cases (according to
+RTS --info
). File sizes suggest that I did not use theoptimise-heavily
flag for the fast binary, but I compiled Agda both with and without this flag, and got a significant slowdown in both cases. The variant compiled withoutoptimise-heavily
was still a couple of megabytes larger than the fast binary, so presumably different libraries were used. The newly compiled binary mostly used libraries that were already released on Hackage when the fast binary was compiled, with the notable exception of unordered-containers 0.2.18.0.The changelog for unordered-containers 0.2.18.0 mentions that one operation is sometimes slower, so I tried to use 0.2.16.0 instead (a version that was already installed, and presumably used for the fast binary). With that change the file size was almost the same as for the fast binary, the difference was only a couple of kilobytes. However, the new binary was still slow, perhaps about 70% slower for my benchmark.
My next step was to check which libraries I had several installed copies of (except for unordered-containers). There were two, hashable and hashtables. After I switched from hashable 1.3.5.0 to 1.4.0.2 and from hashtables 1.2.4.2 to 1.3 the file sizes differed by 64 bytes. The changelogs for these packages did not indicate any interesting performance changes, but after switching the performance was similar to that of the fast binary.
What lessons can be drawn from this? If I had used Stack, then it would presumably have been easier to reproduce the old build. When cabal-install is used it might make sense to store all library versions and installation flags together with benchmark logs (perhaps it suffices to use
cabal v2-freeze
).The text was updated successfully, but these errors were encountered: