Description
Use Case
Potentially improve the Wingc performance.
Proposed Solution
According to my tests, Profile-Guided Optimization (PGO) helps with achieving better performance in many applications in different domains like compilers, static analysis, interpreters, etc like Rust, GCC, Clang, Go compiler (and many other similar projects). Since the Rust language supports PGO, and the Wingc compiler is written in Rust, it could be an interesting idea to optimize the compiler with PGO.
I can suggest the following things to do:
- Perform PGO benchmarks on the Wingc compiler. If it shows improvements - add a note about possible improvements in the Wingc compiler performance with PGO somewhere to the documentation (maybe a note in the README file will be enough).
- Providing an easier way (e.g. a build option) to build scripts with PGO can be useful for the end-users and maintainers since they will be able to optimize the compiler according to their workloads.
- Optimize prebuilt binaries with PGO
Implementation Notes
For the Rust project, I can recommend starting with cargo-pgo tool to perform PGO on a Rust program.
Here are some examples of how PGO is already integrated into other projects' build scripts/pipelines:
- Rustc: a CI script for the multi-stage build
- GCC:
- Clang: Docs
- Python:
- Go: Bash script
- V8: Bazel flag
- ChakraCore: Scripts
- Chromium: Script
- Firefox: Docs
- PHP: Makefile command and old Centminmod scripts
- MySQL: CMake script
- YugabyteDB: GitHub commit
- FoundationDB: Script
- Zstd: Makefile
- Foot: Scripts
- Windows Terminal: GitHub PR
- Pydantic-core: GitHub PR
- file.d: GitHub PR
- OceanBase: CMake flag
I would be happy to answer all your questions about PGO. I am not sure about how the Wingc performance is important right now - I am sure authors can decide better than me in this case :)
P.S. I thought the better place to share this idea is the Discussion GitHub section ("Ideas" part of it) but it seems like I don't have enough rights to create a discussion there - that's why I created the issue.
Component
Compiler
Community Notes
- Please vote by adding a 👍 reaction to the issue to help us prioritize.
- If you are interested to work on this issue, please leave a comment.
- If this issue is labeled needs-discussion, it means the spec has not been finalized yet. Please reach out on the #dev channel in the Wing Slack.
Metadata
Metadata
Assignees
Type
Projects
Status
✅ Done