There's a lot of current research around using machine learning to optimize software. One paper I'm thinking of is: https://dl.acm.org/doi/10.1145/3533028.3533308 where they use ML to optimize latency and hardware usage of Apache Flink dataflow programs.