‹ BackHN Continuity

Thread

Writing Rust code that's fast by asking agents to make the code faster

114 points · 63 comments · mooreds

  1. espeed · · focus · HN ↗
    can LLMs write better code if you keep asking them to “write better code”?

    One of the keys for me was the use of types. Typestate when functions mint witnesses that can only come from it and are required to proceed and newtypes where you use custom types instead of strings so the agent can't forget. You can also use it to force the agent to use the implementation rather than reinvent the wheel by simulating linear types. Types are a much smaller target to optimize and provide constraints that fail loudly at compile time.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.