Hacker News 中文摘要

RSS订阅

人工智能编码的难以忍受之慢 -- The unbearable slowness of AI coding

文章摘要

作者在使用AI编程工具Claude Code两个月后,初期体验高效且兴奋,但随着项目规模扩大,处理代码审查和修复问题的过程变得极其缓慢。尽管代码提交量大幅增加,但作者仍需充当AI的QA工程师,逐一检查和修正问题。这种速度的落差让人感到沮丧,作者对AI能否完全遵循规则持怀疑态度。

文章总结

AI编程的难以忍受之慢

在过去两个月里,我完全使用Claude Code进行编程。起初,这令人兴奋,我迅速完成任务,提交了大量代码。然而,随着我构建了一个相当庞大的应用程序,速度却逐渐变得缓慢。讽刺的是,我正在开发的应用程序可以同时并行运行多个Claude Code实例。

通常,我会在思考新功能时运行5个实例。但当我需要逐一审查所有PR(拉取请求)时,速度就慢了下来。我必须逐个在本地应用这些PR,逐步查看控制台日志,并逐一指示Claude修复它产生的问题。

虽然Claude Code确实提高了效率,我提交的代码量远超以往,但整个过程却令人感到极其缓慢和沮丧。一旦体验过Claude Code的初始加速,你会希望每个编程任务都能如此高效,这种体验甚至让人上瘾。

然而,随着项目的推进,我仍然不得不充当Claude的QA工程师。也许有一天我们会解决这个问题,但我怀疑这会以CLAUDE.md的形式出现。我甚至难以让Claude始终遵循我设定的基本规则,更不用说确保它为一个Web应用程序执行复杂的集成测试了。

在此之前,我将继续在本地拉取PR,添加更多的git钩子以确保代码质量,并快速完成编程任务——直到发现ChatGPT和Claude虚构了库功能,不得不删除Clerk并从头实现GitHub OAuth。

评论总结

主要观点总结:

  1. AI生成代码的质量与可靠性问题

    • 评论者指出AI生成的代码可能存在幻觉(hallucination)问题,导致开发者需要重新实现功能。
    • 引用:"ChatGPT and Claude hallucinated library features and I now have to rip out Clerk and implement GitHub OAuth from scratch."
    • 引用:"It’s kind of crazy to me how the cool kid take on software development... now it seems to be ‘you don’t seriously expect me to look at ‘every single line of code’ I submit, do you?’"
  2. AI在项目不同阶段的表现

    • AI在项目初期处理样板代码时表现良好,但随着项目复杂度的增加,手动编写代码可能更高效。
    • 引用:"AI tools seem excellent at getting through boilerplate stuff at the start of a project. But as time goes on... it’ll be faster to write it yourself."
    • 引用:"When building a project from scratch using AI... it’s also a bad idea when LLM agents do it."
  3. AI工具的速度与效率

    • 一些评论者认为AI工具在处理大型代码库时速度较慢,尤其是在上下文较长的情况下。
    • 引用:"Claude Code takes a long time to grep for what it needs. Cursor is much better at this."
    • 引用:"Waiting for an AI to complete its task isn’t a fun thing at all... I’d chose the fast 70% correct response any day over the slow 90% correct one."
  4. AI在代码审查与测试中的作用

    • 自动化测试被认为是提高AI生成代码质量的关键,缺乏测试可能导致代码不稳定。
    • 引用:"Good automated testing is an enormous factor with respect to how productive you can get with coding agent tools."
    • 引用:"You can prompt Claude into (assess -> fix -> validate) -> assess -> ... loops pretty easily."
  5. AI工具的选择与比较

    • 不同AI工具(如Claude、Gemini、Mistral)在处理复杂任务时表现各异,开发者需要根据具体需求选择合适的工具。
    • 引用:"Gemini seems smarter and better at architecture and best practices. Claude seems dumber but is more focused on getting things done."
    • 引用:"Mistral may not be the smartest chat assistant out there, but I’ve stopped using others entirely given how slow they are compared to Mistral."
  6. AI对开发者工作流程的影响

    • AI改变了开发者的工作方式,部分开发者认为AI帮助他们成为更好的开发者,但也有人表示失去了编程的乐趣。
    • 引用:"Because of LLMs I am now a part time QA engineer, and I think that it’s kinda helping me be a better developer."
    • 引用:"I used to love making function, writing for loops etc. all day long. I do not enjoy spelling out tasks in English and checking that they are done correctly."
  7. AI生成代码的可维护性

    • AI生成的代码可能存在模块化不足、代码重复等问题,适合用于一次性或学习用途,但不适合长期维护。
    • 引用:"The issue I have is that it produce code that is unmaintainable. Poor modularity, code duplication, hidden errors producing spurious bugs."
    • 引用:"It’s useful for learning, to generate throwaway code... so maintainability is not an issue."
  8. AI的记忆与学习能力

    • AI在处理复杂问题时缺乏记忆能力,导致每次任务都需要重新学习,无法保留之前的经验。
    • 引用:"The insights gleaned from that battle are (for Claude) lost forever as soon as I start on a new task."
    • 引用:"The way LLM’s (fail to) handle memory and in-situ learning... is just clearly deficient compared to how human minds work."

总结:

评论者对AI生成代码的态度褒贬不一,认可其在处理样板代码和辅助开发中的效率,但也对其可靠性、速度、可维护性以及缺乏记忆能力提出了批评。开发者需要在使用AI工具时保持警惕,结合自动化测试和代码审查,以确保生成代码的质量。同时,选择合适的AI工具和优化工作流程也是提高效率的关键。