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

Evaluate using Profile-Guided Optimization (PGO) for the Wingc compiler #5558

Closed
zamazan4ik opened this issue Jan 28, 2024 · 2 comments
Closed
Labels
🛠️ compiler Compiler ✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl

Comments

@zamazan4ik
Copy link

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:

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.
@zamazan4ik zamazan4ik added needs-discussion Further discussion is needed prior to impl ✨ enhancement New feature or request labels Jan 28, 2024
@monadabot monadabot added this to Wing Jan 28, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New - not properly defined in Wing Jan 28, 2024
@Chriscbr Chriscbr added the 🛠️ compiler Compiler label Jan 29, 2024
@MarkMcCulloh
Copy link
Contributor

Hey there! Thanks for the links and working on an interesting project.

Our rust code exclusively targets wasm32-wasi, which seems to be unsupported based on Kobzol/cargo-pgo#42 and rust-lang/rust#81684

So I'll close this issue for now, but if I got that wrong or it becomes supported in the future then feel free to reopen

@github-project-automation github-project-automation bot moved this from 🆕 New - not properly defined to ✅ Done in Wing Jan 31, 2024
@revitalbarletz
Copy link

@zamazan4ik how about joining our slack channel https://t.winglang.io/slack? I am curious to hear more about this project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠️ compiler Compiler ✨ enhancement New feature or request needs-discussion Further discussion is needed prior to impl
Projects
Archived in project
Development

No branches or pull requests

4 participants