Skip to content

automatic profile guided optimization in release modes based on test cases #237

Open

Description

@andrewrk

Research idea:

Have a set of test cases that are designed to mimic real world payload.

Zig compiler tries various optimization techniques, runs these tests, collects performance statistics, analyzes the results of the performance statistics to try different optimization techniques, and then finally settles on an optimization strategy informed by this process.

This can be used to inform which functions to inline, which parts of the code to apply certain optimization passes to, which parts of the code to perhaps not do this (maybe the instruction cache size was important there), and in other words have an optimization process guided by test data. I believe GCC has already paved the way for a lot of this research.

Activity

  1. added
    enhancementSolving this issue will likely involve adding new logic or components to the codebase.
    on Jan 31, 2017
  2. added this to the 0.3.0 milestone on May 7, 2017
  3. modified the milestones: 0.3.0, 0.4.0 on Feb 28, 2018
  4. changed the title [-]optimization profiling based on test cases[/-] [+]automatic profile guided optimization in release modes based on test cases[/+] on Aug 8, 2018
  5. modified the milestones: 0.4.0, 0.5.0 on Feb 3, 2019
  6. modified the milestones: 0.5.0, 0.6.0 on Sep 11, 2019
  7. modified the milestones: 0.6.0, 0.7.0 on Oct 17, 2019
  8. modified the milestones: 0.7.0, 0.8.0 on Apr 15, 2020
  9. ThePC007 commented on Oct 27, 2020

    @ThePC007

    Would making sure that non-inlined functions that frequently call each other are placed in close proximity to each other in order to improve the instruction cache locality also be a thing that could be considered when performing such research?

  10. modified the milestones: 0.8.0, 0.9.0 on Nov 6, 2020
  11. modified the milestones: 0.9.0, 0.10.0 on May 19, 2021
  12. VoilaNeighbor commented on Mar 22, 2025

    @VoilaNeighbor

    A typical complex project would run system tests from end to end. It may fall into a local maximum to optimize by marked source-file unit tests. Instead, it may be better to support users registering "auto entry points" in zig.zon files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSolving this issue will likely involve adding new logic or components to the codebase.optimization

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions