[random idea] Auto detect parallelizable code

Given that Rust’s slogan is fearless concurrency, I think we can encourage parallel code more aggressively. There is an idea from my mind:

  1. It is probably feasible to detect potential parallelizable code automatically based on MIR.

  2. Not all the parallelizable code should be paralleled. We need benchmark number before this kind of optimization is implemented. Maybe we can add a new compiler option to inject code which can accumulate related performance statistics:

    rustc --probe-parellel --release myproject.rs
    

We can use this binary in a production environment, and it will report most valuable parallel optimization candidates.

What do you think about this idea?

5 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.