I'm sorry, but you still have to think
DHH, the creator of the Ruby on Rails framework, has rewritten Campfire Once from Ruby on Rails to Rust, as well as adding versions in other languages such as Elixir and Go. This move has generated interest, as it provides insight into the outcomes of using AI agents without reading the code. However, the results are not encouraging, indicating that stopping to read and think may be necessary.
One issue with the rewrites is the lack of specific prompts, leading to many decisions being a matter of chance. These decisions often revolve around factors like backwards compatibility, latency, throughput, memory usage, and the acceptability of losing new content notifications after a crash. Although the developers may not care about these aspects, the language model will implicitly address them.
Comparing the rewrites reveals differences in how they handle backwards compatibility and other constraints. The Rust version does not maintain 100% compatibility, for instance, by dropping the CSRF token for easier caching and using in-process queues for notifications. The Elixir rewrite, on the other hand, is closer to the original Rails version, making the comparison less meaningful.
From a code inspection standpoint, the Elixir version shows some concerns, such as a single process sequentially processing SQL queries, which may not be optimal for concurrency. However, DHH seems to believe that the Rust version's clanker couldn't write efficient code.
Another issue arises from the blocking operations in Rust, which can negatively impact performance. The cooperative scheduling in Rust means that tasks must yield to allow others to run, making it essential to use async operations whenever possible. The Rust rewrite employs both blocking and async tasks, leading to potential inefficiencies.
Furthermore, benchmarks used to evaluate the rewrites have their limitations. They primarily measure throughput, disregarding other critical aspects of the system. The delivery rate of notifications under heavy load, for example, is significantly lower in the Rust version (1%) compared to the Elixir version (100%). This discrepancy highlights the importance of considering different properties of the system when evaluating performance under load.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.
This story
This is one outlet's version. Read the fullest account.
- I'm sorry, but you still have to think itsallaboutthebit.com