logoalt Hacker News

rescbrtoday at 12:52 AM1 replyview on HN

If you ask an LLM to code whatever, it definitely won’t produce optimized code.

If you direct it to do a specific task to find memory and cpu optimization points, based on perf metrics, then it’s a completely different world.


Replies

jfimtoday at 1:07 AM

You can also tell it the optimization to implement.

I asked Claude to find all the valid words on a Boggle board given a dictionary and it wrote a simple implementation that basically tried to search for every single word on the board. Telling it to prune the dictionary first by building a bit mask of the letters in each word and on the board and then checking if the word is even possible to have on the board gave something like a 600x speedup with just a simple prompt of what to do.

That does assume that one has an idea of how to optimize though and what are the bottlenecks.

show 1 reply