{
  "id": 9166918,
  "title": "Writing Rust code that's faster than state-of-the-art libraries by asking agents to make the code faster",
  "url": "https://urgent.news/2026/09/22/writing-rust-code-thats-faster-than-state-of-the-art-libraries-by",
  "topic": "ai",
  "section": "AI",
  "published": "2026-09-22T17:03:48.000Z",
  "source": {
    "name": "Lobsters",
    "slug": "lobsters",
    "url": "https://minimaxir.com/2026/09/agentic-iteration/"
  },
  "original_language": "en",
  "account": "In January 2025, the author hypothesized that LLMs could write better code by continuously asking them to \"write better code.\" Although Sonnet 3.5 initially abused the ambiguity of the instruction, the author later tested agentic LLMs like Claude Opus 4.5, which could iteratively improve on algorithmic Python code.\n\nThe author proposed that modern agentic LLMs could write Rust code faster than existing state-of-the-art libraries by using Rust's speed and memory safety, as well as PyO3 to bridge Rust and Python for ergonomic use. The author's first test case involved reimplementing the UMAP algorithm in Rust, which is a valuable machine learning algorithm but scales poorly to big data.\n\nTo measure performance improvements, the author utilized Rust's comprehensive benchmarking tool, criterion. They provided the agent with a detailed prompt, including the creation of benchmarks using different input data sizes and a requirement to iterate on code until no further speed improvements were achievable. The agent was given permission to make autonomous optimizations until it reached the \"fast as it can be\" threshold.\n\nThe author found that Opus 4.5 was somewhat lazy in its optimization efforts, but by refining the prompt to include a clear pass/fail target, it was able to achieve significantly faster code. The benchmarks showed speedups ranging from 2x to 20x, depending on the domain. The author concluded that this experiment demonstrated the potential of agentic LLMs to create faster Rust code for Python integration.",
  "summary": null,
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 3,
    "also_reported_by": [
      {
        "outlet": "Hacker News",
        "title": "Writing Rust code that's fast by asking agents to make the code faster",
        "url": "https://urgent.news/2026/09/22/writing-rust-code-thats-fast-by-asking-agents-to-make-the-code-faster",
        "published": "2026-09-22T15:38:24.000Z"
      },
      {
        "outlet": "Lobsters",
        "title": "Why do common Rust packages depend on C code? (2023)",
        "url": "https://urgent.news/2026/09/22/why-do-common-rust-packages-depend-on-c-code-2023",
        "published": "2026-09-22T20:42:02.000Z"
      }
    ]
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}