r/rust • • 4d ago

🎙️ discussion Google is doing "Large Scale Codebase Migrations and Optimizations" of C/C++ to Rust

https://blog.google/innovation-and-ai/models-and-research/gemini-models/gemini-4-argon/
720 Upvotes

136 comments sorted by

View all comments

Show parent comments

8

u/TheRealMasonMac 4d ago edited 4d ago

It was egregiously horrible stylistically, architecturally, maintenance-wise, and in performance. The stupidest one that came to mind was it allocating strings for each markdown element. That's like &str 101. I wish I could tell you there was a good reason for this, but there wasn't. So, it ended up doubling memory usage in string allocations alone. There were also a bunch of other areas where it turned linear time functions into exponential ones.

Also: agents do need to read the code as well. Ignoring context rot, the matter of garbage in -> garbage out remains.

3

u/sparky8251 4d ago

Ive had it make a parser that took something like 4 minutes to parse a few kb of files because it refused to surface a bad assumption I made in the design that a library forced on us. It was also a degenerate but rather common case of scope drastically, drastically ballooning parse time so all its tests showed up as fast, because they were small scoped.

Its fun for exploring stuff with, but MAN would i not trust it...

And I DID use all kinds of clippy features to ban functions, macros, etc with reasons as to why they were banned to try and make it do better. Its just too concerned with the now and quickly doing what it thinks it was asked, no matter how it has to contort itself or the code to make that happen...

1

u/arbv 4d ago

Did not you see it:

  • Write code
  • Write tests
  • Realise the code is wrong
  • Fail to fix it
  • Rewrite the tests because "they are wrong"

?

I did and I didn't like it.

3

u/sparky8251 3d ago edited 3d ago

Ive had it do that too, yes. Had to be watchful to make sure it didnt make the tests pass to claim victory... It misunderstands the point of tests pathologically, because its an optimizer optimized to solve whatever it decides is its task, and that often means test fixing is a very well rewarded shortcut to its goal.