Skip to content

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

Closed
@zamazan4ik

Description

@zamazan4ik

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions