Today I wanted to test Gemini 3.8 Flash (a cloud model from Google). I decided to compare its output to a local Gemma 4 model (specifically gemma-4-26B_q4_0-it.gguf). I wanted to generate a somewhat complex, performance-tuned Rust parsing function.
First I tested Gemma 4. It used a while-loop over the string's bytes, and a state machine. It called starts_with several times. The function appears to work correctly, although it would use starts_with 4 times over every byte.
Next, I used Gemini 3.8 Flash on OpenRouter. It generated the same basic function, but with 2 additional optimizations. It uses a "fast path" through quoted strings, and then a match before calling starts_with. So it uses starts_with 1 time for every byte.
Both functions will work correctly; Gemini 3.8 Flash used a fast path, and reduced the number of starts_with calls from 4 to 1 on each byte. So Gemini 3.8 Flash, for the cost of $0.01, gave me faster code. The speed difference may be small, but I pasted the Gemini function into my program.