r/PiCodingAgent • • 14d ago

Discussion Gemini was 5x slower than Claude at code edits in pi, so I stopped letting it run `edit`

I kept switching from Gemini back to Claude mid-session because `edit(oldText, newText)` calls were taking 42s median (172s p95) vs 9s on Opus. In 599 edit calls from my session logs, Gemini averaged 9.3KB of `oldText`/`newText` per call (4x more than Claude) and burned thousands of thinking tokens checking whitespace before streaming JSON-escaped strings.

So I hid `edit` on Gemini turns in pi and wired up `fast_edit(path, instructions)` instead. Gemini stays on high thinking and writes what to change, then DeepSeek (`reasoning_effort="none"`, ~195 tok/s) outputs raw `SPAN: L<start>..L<end>` line replacements against a numbered view of the file.

On a SQL refactor in a 620-line file, edit time dropped from 103s to 29s (23s Gemini + 6s DeepSeek). `oldText not found` retries dropped to zero.

*(Disclaimer: session log analysis and testbench runs were done with `carbon-high`.)*

20 Upvotes

9 comments sorted by

5

u/roninXpl 14d ago

For some time now agents prefer bash/python for edits as it results in less edit errors.

3

u/Pbd1194 14d ago

yeap. opus has always done that by default. bonehead gemini doesnt do that. i had to literally instruct it to use python to perform edits.

1

u/CameraTop8976 14d ago

It is the biggest token hog ever

2

u/Throwaway2K3HEHE 14d ago

How are you calling claude vs gemini though? If you use AGY CLI ACP it has some warmup time that makes it initially slow. Otherwise you might be feeling what others are feeling with the slowness. I have multiple accounts and run timing tests 1 or 2 times a day. One day it can be fine, 2-5s for a respone and sometimes 60-90s for the first token and all I ask it is "1 + 1" so there should be literally zero thinking to delay the response.

1

u/Pbd1194 14d ago

hmm. i am using pi coding agent only. i am not sure if you are inquiring about sth else.

1

u/Throwaway2K3HEHE 9d ago

Id actually stop doing this. I read the ToS and thought it was fine but Google employees actually said using AGY or ACP from another harness violates ToS. You can only call them via script.

5

u/xRebellion_ 14d ago

Curious how edit is done in antigravity or gemini's cli, since surely they trained it based on that?

1

u/Doohickey-d 14d ago

This is what Cursor does (used to do?): code-generating model emits a sort of human-readable edit, with comments like `//existing code here...` interspersed with the new code, in it, and then hands that off to a specialized fast "apply" model which then actually edits the file (what you're doing with deepseek). For example https://openrouter.ai/morph/morph-v3-large

but it seems nobody does this anymore, since the latest edit apply models all seem to be from 2025.

1

u/omppulse 13d ago

Pretty cool approach. omp ended up going a similar direction natively with its hashline edit mode. The model never re-sends oldText, it just edits line ranges from its last read, and each read carries a little snapshot tag so if the file changed underneath it the edit gets rejected instead of misapplied. No whitespace matching means no "oldText not found" loop.

Curious how often DeepSeek's spans land wrong when the file's changed between the read and the edit though?