From Hotspots to Edit Locations: Guiding Repository-Level Code Optimization
Abstract
Modern automatic code optimization approaches rely on an LLM to optimize code. Given the cost of invoking an LLM and its limited context length, in large repositories, we must choose where to optimize within a limited budget. Profiling identifies costly functions, called hotspots, but optimizing hotspots alone may not be sufficient: we may also need to optimize their (direct or indirect) callers to reduce the calls to hotspots. However, the callers may be too many to examine within a limited budget. We introduce CHICO, a localization approach that combines profiling information with optimization opportunities detection. Given a hotspot function and its callers, our approach uses a lightweight static analysis to detect potential opportunities to reduce the number of calls to the hotspot in the callers, and consider only these callers for the LLM to optimize. We implement CHICO as a prototype that integrates this localization approach with SemOpt, a state-of-the-art optimization approach for a single function. We evaluate the system on GSO and SWE-fficiency-Lite against four baselines using four language models. Our approach successfully optimizes 10.29–123.53% more cases than the baselines on GSO and 12.50–239.13% on SWE-fficiency-Lite.
est. 32% chance this paper gets accepted at ICLR 2027.
What do you think this paper will get?
All positions stay anonymous.