Use -fspecialize-aggressively to improve performance by 30% on ACME build#4584
Use -fspecialize-aggressively to improve performance by 30% on ACME build#4584purefunctor merged 2 commits intopurescript:masterpurescript/purescript:masterfrom
Conversation
f-f
left a comment
There was a problem hiding this comment.
Very happy to merge this patch 😄
Can anyone else have a look?
garyb
left a comment
There was a problem hiding this comment.
Binary size went from 110MB to 130MB. I think this is fine and worth the speed improvements.
Seems like a reasonable tradeoff to me 👍
|
Wow, that's great improvement! I can reproduce the 30% speedup for ACME, and on our work codebase it is more like 40%, with both single-threaded and multi-threaded builds. Could you also add it to diff --git a/purescript.cabal b/purescript.cabal
index 7601ec39..70e7dabb 100644
--- a/purescript.cabal
+++ b/purescript.cabal
@@ -402,7 +402,7 @@ executable purs
import: defaults
hs-source-dirs: app
main-is: Main.hs
- ghc-options: -fno-warn-unused-do-bind -threaded -rtsopts -with-rtsopts=-N -Wno-unused-packages
+ ghc-options: -fno-warn-unused-do-bind -threaded -rtsopts -with-rtsopts=-N -Wno-unused-packages -fspecialize-aggressively -fexpose-all-unfoldings
build-depends:
prettyprinter >=1.7.1 && <1.8,
prettyprinter-ansi-terminal >=1.1.3 && <1.2, |
|
@MonoidMusician I am not sure where that should go, If it goes to The benefit of adding it to What do you think? |
I'm not sure how that follows. Is there a problem with adding it to just executable like I did? I am not a cabal/stack expert but it did seem to build me a binary with optimizations. I guess any solution that adds it to purs-the-binary and does not require it on purescript-the-library is fine with me. |
|
Both would work for the release-distributed builds, but for Hackage-based installs it would need to be in |
|
This one is quite subtle actually, the inlining/specialisation would only apply to the |
|
Okay added to |
…uild (purescript#4584) * Use -fspecialize-aggressively to improve performance * add fspecialize to cabal project
Description of the change
Use -flag-fspecialise-aggressively to improve performance by 30% on ACME build.
Stats for ACME build before change
Stats for ACME build after change
Binary size went from 110MB to 130MB. I think this is fine and worth the speed improvements.
Compilation time of purs takes longer, but when dev we can always use
stack --fastRepo with acme build: https://github.com/seastian/purs-acme
Yes we spend so much time doing GC 🫣, much of it can be improved by using different RTS options (
+RTS -A256m -n16m -RTS) at the cost of more ram.What do you all think?
Checklist: