Discarding AI-Generated Code
There is a hot function in my Rust program that runs about a million times. Even a small change can cause the entire program to run faster or (more usually) slower.
Discarding Code
I used DeepSeek V4 Flash to explore many possible optimizations to this function. One of the first optimizations I added helped a bit. Unfortunately, none of the later ones did.
It seems even AI cannot bend reality to one's will. Optimizing an already-optimized function is sometimes just not possible. Later I did find a way to rewrite some surrounding code and speed up the program; and this I suppose counts as an optimization.
But it does sort of dispel my fantasies of super-intelligent AIs optimizing code in amazing ways. This is just not possible. Fortunately DeepSeek V4 Flash is very cheap, so many of the failed experiments did not cost me much. I discarded much of the AI-generated code.