· AI dev tools

pgrust, LLMs lower barrier to entry for complex performance optimizations

The ability to make software faster is no longer a matter of insurmountable difficulty.


The diminishing cost of specialized performance engineering work has dropped by many orders of magnitude, meaning that performance tasks previously requiring individuals or teams with rare skill sets can now be accomplished by anyone capable of typing a few sentences. Consequently, optimizations that were once prohibitively expensive for all but the very largest or most profitable undertakings are now within reach. This sentiment aligns with Marc Brooker's agreement that "Dynamic custom software, fitted to a particular workload rather than a class of workloads, seems like a very likely outcome," a development which, naturally, brings with it its own set of thrilling risks and opportunities. This trend brings to mind FFTW, alongside numerous obscure demoscene techniques focused on achieving peak speed and minimal size for a specific problem—often tied to particular hardware. I recall one demo that ingeniously repurposed its code as textures to achieve superior cache locality.

Some circulating commentary suggests that AI offers no assistance because "code was never the hard part." While this holds true in certain areas, in others, the act of writing the code itself constituted the primary challenge. Just-in-time (JIT) compilers serve as a prime illustration of this. Historically, the scarcity of JIT compilers suggested that building one was too arduous to be worthwhile. However, LLMs have significantly lowered this entry barrier, making the creation of a JIT compiler much more accessible. This forms the core premise behind pgrust. Databases, for instance, were historically among the most complex pieces of software to construct, and this complexity imposed severe limitations. Now, with the advent of AI, we possess the capacity to aim for more ambitious software designs.

Consider FRE, the regular expression engine developed in a prior piece. It was created by tasking an agent with a month-long cycle of enhancing regex engine performance, utilizing the rebar regex benchmark suite. Initially, this resulted in FRE becoming heavily overfit to the rebar suite. However, after we alerted the agent to the existence of a holdout benchmark, it generalized its optimizations sufficiently to achieve acceptable performance on that unseen data. Although there is no compelling reason to favor a "software factory" regex engine over a rigorously tested one on holdout benchmarks, a key characteristic of FRE was its native Ahead-Of-Time (AOT) compiled version's strong performance during extended searches. It is logical to hypothesize that running the native code compiler in a separate thread while the standard ripgrep matcher operates, and then switching to the native code upon compilation completion, could yield improved performance. Naturally, this approach would incur a performance penalty for short queries due to the thread dedicated to compilation, but I place far greater value on how long ripgrep operates over many seconds or minutes compared to its behavior over a few seconds, making this tradeoff acceptable.

In a manner analogous to how one might construct a regex engine in mere minutes of human effort, we can execute this experiment in a few minutes of human time. By inputting a few sentences, an agent performed the necessary work—a feat that would represent a substantial amount of code surgery for a human—and it ran the benchmark against actual ripgrep queries sourced from my codex history. For longer queries, we observed a performance boost ranging from 2x to 4x for a handful of very simple queries. However, the majority of queries are more intricate, and when tested against representative holdout queries—those where AOT compilation is expected to be beneficial—we saw approximately a 7% speed increase. While this is not a revolutionary finding, it is certainly not a disappointing outcome for the few minutes spent prompting codex (and it is still capable of further refinement).

This endeavor might seem somewhat frivolous, as the most obvious method to speed up repeated text searching on a computer is not to build a native code compiler for regex matching, but rather to establish an index. Nevertheless, the crucial takeaway here is that this type of technical labor, which once demanded considerable time and specialized expertise, can now be executed trivially. If the goal were to build a text index, I could leverage my prior work on BitFunnel, the Bing search index engineered for rapid, constant text ingestion and which earned a Best Paper Award at SIGIR. This leads to considerations for experiments aimed at creating a fast local index of my entire machine. While existing projects I've observed seem focused on indexing code directories, what truly degrades my machine's performance is when codex directs ripgrep against vast temporary directories filled with generated files, eventually expanding its search to cover my entire system if it fails to find something locally.

If I were situated in an AI research laboratory with access to cutting-edge models running on Cerebras chips or other accelerators that dramatically boost tokens per second and subsequently increase search load, I might survey existing indexers to determine their sufficiency or whether a custom build is warranted. Although the open-source version of BitFunnel "only" incorporates a bytecode interpreter and one JIT, the Bing version features multiple JIT compilers. A project achieving that level of optimization used to be a massive undertaking, but the statement "I could do that in a weekend" is now genuinely applicable to certain such projects. With my modest $200/month account, I find that a somewhat faster ripgrep combined with any readily available index is adequate, suggesting that this whole-machine indexing project might remain an "exercise for the reader (who works at an AI lab)."

This dramatic reduction in optimization costs has been evident since November 2025, and perhaps even earlier with public models (and I am certain this trend predates that, existing with the resources of AI labs). As an illustration from the GPT-5.1 or 5.2 era, without prior knowledge of game AIs, I attempted to construct an Azul AI. This resulting AI demonstrated the highest performance among all tested entities for that particular game by a substantial margin. Based on the thesis describing the second strongest AI, my creation is likely superior in the "AI" aspects, but its primary advantage lies in optimization, achieved while consuming what appears to be perhaps two orders of magnitude less time (estimated by reviewing the thesis, the process, and comparing it to my own efforts), and primarily running on my laptop instead of a cluster of machines (which inherently limits bandwidth for parameter tuning and experimentation). For instance, that other AI operates single-threaded, whereas my AI is multi-threaded. Given that I possess both a native code version and a cumbersome shared WASM memory plus JavaScript version, along with two distinct search architectures tailored for different versions—each "requiring" fundamentally different multi-threading algorithms (minimax for a small, fast network versus MCTS for a larger network)—this would have constituted a significant manual endeavor. Furthermore, because I allowed an LLM to select the multi-threading algorithm based on its own (incorrect) reasoning several times before I spent thirty minutes studying game AI multi-threading algorithms myself, I ended up rewriting (having codex rewrite) the multi-threading algorithm multiple times.

Numerous standard procedures for debugging and verifying a multithreading algorithm for something like this, such as implementing replay from debug logs to reproduce bugs even when the algorithm is nondeterministic, would have taken days or even a week of manual labor. However, this is precisely the type of task an agent can handle trivially in a loop (simply instructing it to attempt log replay and insert logging for non-determinism every time a perfect replay is not achieved). The sheer volume of tedious work previously required to get such a delicate optimization functional has vanished. This benefit extends to countless other complex optimizations. Drawing from my background in writing CPU microcode, conducting CPU verification, and optimizing a search engine index, I possess experience in evaluating optimizations and making a decision based on whether the effort is worth the potential gain, such as when considering an optimization that might yield a 2% performance increase but would require "N person-days to verify that this tricky optimization works." Now that this "N" has plummeted by a massive factor (variable, but frequently 1000x, 10000x, or even 1000000x in human time, perhaps closer to 1000x when comparing dollar costs using metered token rates against the Bing engineer who authored the search index's JIT compilers), the quantity of such optimizations that make sense to pursue increases dramatically. The same applies to optimizations whose success is uncertain. I previously sometimes considered an optimization I wasn't certain would speed things up, estimating it would require "M hours to implement to the point where we have a good enough measurement to guess at the performance impact." Many more of these optimizations are now worth attempting.

Returning to the game AI example, for the AI I tested, it appears that for every doubling in speed, you gain approximately 100 Elo points (more than in chess, I suspect because draws are exceedingly rare). Merely incorporating multithreading is sufficient to surpass a comparable AI running on a large machine. When stacking in ten to twenty additional optimizations that most individuals would deem too bothersome to implement manually, the resulting strength difference is immense, making it unreasonable to attempt to compete with a manually crafted AI. The game AI scenario is somewhat more complicated than typical software because many desired optimizations actually alter the outcome, and there is no simple, cheap method to determine if the speed increase combined with the result change leads to a practically better or worse outcome. Moreover, as mentioned before, current publicly available state-of-the-art models are rather poor at experimental design, necessitating that I establish the framework they utilized to judge an optimization's merit; once that structure was in place, however, it resembled any standard optimization problem.

In another instance, while preparing for performance interviews, Jamie Brandon utilized Anthropic's publicly available performance takehome. After completing it, he allowed Claude to continue his work, resulting in a significantly superior outcome. Upon reviewing what Claude accomplished that he had missed

Why it matters

This trend suggests that high-level software performance tuning, once restricted to elite engineers, is becoming accessible to more developers. Readers should watch how this democratization of complex optimization affects the tooling landscape for large-scale applications.

Earlier coverage

Related coverage

Also worth reading

  1. Google Cloud CISO Chris Betz discusses agentic AI security and SOC future
  2. OpenAI Codex agents build $100M product in six weeks, Yang details testing and agent management
  3. trynix.dev boots GUI programs now, running Solitaire, Firefox, and more
  4. CISA lists N-able MailAssure, MONAI Label flaws in KEV catalog citing active exploitation
  5. OpenAI and Cisco release Shirudo, open-source tool to shield unpatched Linux systems