OctSum
00:00 / 11:19

AICodeKing · 11:19

hi, welcome to another video.

嗨,欢迎收看新一期视频。

so, lauren tan recently posted on x that your prompts should feel a little delusional.

劳伦·谭最近在 X 上发帖说,你的提示词应该带点不切实际的野心。

and that post went viral.

这条帖子迅速走红。

she gave four examples.

她给出了四个例子。

make this 100x faster.

把速度提升 100 倍。

delete half the code base without breaking anything.

删掉一半代码库,但不能破坏任何东西。

turn every bug we've ever fixed into a property test.

把我们修复过的所有 bug 都转成属性测试。

and find all implicit invariants.

找出所有隐含的不变量。

then formally prove.

然后进行形式化证明。

prove them or find counterexamples.

证明它们,或者找出反例。

as a normal developer, those sound kinda insane.

作为一名普通开发者,这些听起来有点疯狂。

deleting half a codebase is how you end up writing a postmortem, and formally proving every invariant is a research project, not a ticket.

删掉一半代码库,最后可能就得写事后复盘;而形式化证明每个不变量,是一个研究项目,不是一张工单。

but that is exactly the point.

但这恰恰就是重点。

these are goals you would never give a human teammate, and she's saying you should give them to your agents.

这些目标你绝不会交给人类队友,而她的意思是,你应该把它们交给你的智能体。

then adi osmani quoted the post and said that you should aim higher with agents than feels reasonable, because the 10 to 100x more ambitious version of your goals.

随后,阿迪·奥斯马尼引用了这条帖子,并表示,你应该给智能体设定比合理范围更高的目标,因为目标如果雄心勃勃 10 到 100 倍,

may be more achievable with today's models than you think.

用如今的模型实现起来,或许比你想象的更容易。

and to be honest, this is one of the techniques i use the most, so i'll explain why it works and where it fails.

说实话,这是我最常用的技巧之一,所以我会解释它为什么有效,以及在哪些情况下会失效。

then show you three real runs from my own work in PandaCode and give you the exact prompt i use.

然后,我会展示我在 PandaCode 中实际做过的三次运行,并给出我使用的确切提示词。

one of those runs ended with me getting called out publicly for a benchmark i posted, and that one taught me the most, so let's get right into it.

其中一次运行的结果是,我因为发布的一项基准测试而被公开批评;那次经历教会了我最多,所以我们直接开始吧。

the reason this works is that the size of the goal changes what the agent goes looking for.

这个方法之所以有效,是因为目标的大小会改变智能体会去寻找什么。

if you say, make this faster, the agent finds the first slow thing, fixes it, gets maybe a 10 or 20% win, and tells you it's done.

如果你说“把这个弄快点”,智能体会找到第一个慢的地方,修好它,可能提升 10% 或 20%,然后告诉你搞定了。

and from its point of view, it is done.

从它的角度来看,这确实算是搞定了。

but if you say, keep going until you reach the performance floor, a small tweak doesn't satisfy the goal anymore.

但如果你说“继续改进,直到达到性能极限”,那么小修小补就不再符合目标了。

the agent has to measure where the time actually goes.

智能体必须测量时间实际上都花在哪里。

it has to ask whether the library is the problem, whether work can move off the main thread, or whether things can happen before the user clicks.

它必须考虑:问题是不是出在库上,能不能把工作移出主线程,或者能不能在用户点击之前就完成某些操作。

it's forced to rethink the design instead of polishing the slowest line.

它不得不重新思考设计,而不是只优化最慢的那一行代码。

there's even a skill for this now, called be delusional, and it puts it pretty well.

现在甚至有一个叫“Be Delusional”(大胆设想)的技能,它把这点说得相当到位。

even landing a third of the way to a 100x goal beats a 20% goal by an order of magnitude, as long as the target is locked to an invariant that can't break and a real verification bar.

只要目标锁定在不会被破坏的不变量上,并且有真正的验证标准,那么即使只达到 100 倍目标的三分之一,也远胜于只设定 20% 的目标。

and under lauren's post, someone said they told neon to make their ci 10x faster, it made it 8x faster, and they felt betrayed, which is a joke, but 8x is a result you probably wouldn't get by asking for a bit faster.

劳伦的帖子下面,有人说他们让 Neon 把 CI 速度提高 10 倍,结果它提高了 8 倍,他们却觉得自己被辜负了——这当然是个玩笑,但要是只要求快一点,你大概得不到 8 倍的提升。

now some developers say it works for them, but not everyone agrees.

现在,有些开发者说这对他们有效,但并不是所有人都认同。

one of the top replies just says, at least for me it didn't work.

一条热门回复只说:“至少对我来说,这招没用。”

another says it did not go so well, a few pointed out the token cost.

另一条回复说效果不太好,还有几个人提到了 token 成本。

the better replies are about verification.

更有价值的回复都在讨论验证。

under addy's post, one person wrote that you need to keep the verification loop extremely tight, and addy agreed that the verification layer needs to be relatively solid.

在 Addy 的帖子下面,有人写道,你必须让验证闭环保持极其紧密;Addy 也认同,验证层需要足够可靠。

another reply said that delete half the codebase without breaking anything is only as safe as what the tests can see, so they would break a few lines on purpose first and check that the suite goes red.

另一条回复说,“删掉一半代码库而不破坏任何东西”有多安全,完全取决于测试能覆盖到什么;因此,他们会先故意破坏几行代码,确认测试套件会报错。

ambitious goals need a referee, and someone else suggested keeping some tests where the agent can't see them at all.

雄心勃勃的目标需要裁判;还有人建议留一些智能体完全看不到的测试。

so, if you ask me, the difference between it worked and it didn't is not the bold goal.

所以,要我说,“它奏效了”和“它没奏效”之间的区别,不在于目标有多大胆。

it's whether something other than the agent decides when the goal is met, because agents will happily claim success, and the numbers they report are usually their own.

关键在于,是否有智能体之外的东西来判定目标何时达成,因为智能体会很乐意宣称成功,而它们报告的数字通常也是自己算出来的。

the first run was in panda code.

第一次运行是在 Panda Code 里进行的。

i wanted the diffs in the changes panel to be really fast.

我想让变更面板中的差异显示得非常快。

i told the agent it could even swap libraries if that meant way better performance, to keep going until it reached the performance floor, and to run a council of models that scores it out of 10 until it gets a 9.5.

我告诉代理,如果这样能大幅提升性能,甚至可以更换库;让它持续改进,直到达到性能底线,并组织一个模型评审团给它打分(满分 10 分),直到拿到 9.5 分。

it didn't start by editing.

它没有一上来就修改代码。

first, it sent out two workers.

首先,它派出了两名工作代理。

one built a benchmark, and the other researched whether to tune the diff library or replace it.

一名搭建基准测试,另一名调查是调优 diff 库还是替换它。

the answer was to keep it and tune it, so it switched to a faster webassembly highlighter, moved highlighting off the main thread so the text shows up first and the colors follow, and started fetching a file's diff as soon as you hover over it.

结论是保留并调优它。于是它换用了速度更快的 WebAssembly 语法高亮器,把高亮处理移出主线程,让文本先显示、颜色随后跟上,还开始在你将鼠标悬停在文件上时就获取该文件的 diff。

then the council came in, three judges on different models, gpt-6 luna, Kimi K3.1 pro, and claude fable, each running the benchmark itself.

接着,评审团登场了:三位使用不同模型的评审——GPT-6 Luna、Kimi K3.1 pro 和 claude fable——每位都亲自运行了基准测试。

the first scores were around 8, but the findings mattered more.

第一轮评分大约是 8 分,但更重要的是他们的发现。

the slow cold open the agent was worried about was mostly the dev server, and against a production build it was much faster, and on a large diff, the colors could lag almost a second behind the text.

代理担心的缓慢冷启动,大部分其实是开发服务器造成的;对比生产构建时,速度快得多。而在大型 diff 中,颜色显示几乎会比文本晚一秒。

in round two, the judges caught something else.

第二轮中,评审们又发现了别的问题。

the agent admitted that the cold open numbers it had reported were too low, because they actually matched the warm and hover times the judges measured.

代理承认,自己报告的冷启动数据偏低,因为那些数据实际上和评审测得的热启动及悬停耗时相符。

so, the next worker was told to report the real cold numbers.

因此,接下来它要求另一名工作代理报告真实的冷启动数据。

after all eight rounds, the best score was 9.4, so it missed the 9.5, and told me so.

八轮全部结束后,最高分是 9.4,所以它没达到 9.5,并如实告诉了我。

in its final production build run, a 4,000 line diff showed its first rows in 33 milliseconds.

在最后一次生产构建测试中,一个 4,000 行的 diff 在 33 毫秒内就显示出了首批行。

and the colors arrived in 181.

颜色则在 181 毫秒后显示出来。

the original 1.6 second baseline appears to have come from the dev server.

原先 1.6 秒的基准数据似乎来自开发服务器。

the judges had already flagged that kind of mismatch in round one, a 30,000 line diff that used to fall back to plain text, now renders properly.

评审们在第一轮就指出了这类数据不匹配;一个过去会退回纯文本显示的 30,000 行 diff,现在可以正常渲染了。

it also removed a small weight from every git call.

它还减少了每次 git 调用的一点开销。

these are agent reported numbers, so take them with a grain of salt.

这些数据都是代理报告的,所以请谨慎看待。

and it told me it never launched the packaged app to check them there, when i said ship it.

而且,当我说“发布吧”时,它告诉我,它从未启动打包后的应用来核实这些数据。

the agent first moved the fast viewer into a redesigned changes panel that had landed on main, measured it again, and shipped it in version 0.3.77.

代理先把快速查看器移进了已合入 main 的重新设计版更改面板,重新测量后,随 0.3.77 版本发布了。

the second run was about memory.

第二轮的重点是内存。

i asked it to benchmark everything and make panda code really memory efficient until we reached the floor with a council of muse wonderful, Kimi K3.1 pro and opus 5.5 rating it out of 10 where 10 is the floor and to check for bugs so everything stays usable.

我让它对所有内容进行基准测试,并让 Panda 代码尽可能节省内存,直到达到极限;同时让一个由 Muse、Kimi K3.1 Pro 和 Opus 5.5 组成的评审团按 10 分制打分,10 分代表达到极限,并检查漏洞,确保一切仍然可用。

it started with a memory benchmark and two read-only auditors.

它先做了内存基准测试,并安排了两个只读审查员。

then fix workers went after caches, a listener leak, and spare Claude processes.

接着,修复任务的工作者处理了缓存、一个监听器泄漏,以及多余的 Claude 进程。

the first ratings were 7 from muse and 6 from opus, but the council also found bugs in the agent's own changes.

最初 Muse 给了 7 分,Opus 给了 6 分,但评审团还发现了智能体自身修改中的漏洞。

a new shared click handler was blocking other clicks, and pr diffs were downloaded again every time you switched tabs.

一个新建的共享点击处理程序阻止了其他点击,而且每次切换标签页时,PR 差异都会重新下载。

that's exactly why you want judges.

这正是需要评审者的原因。

by the end, going by the agent's own benchmark, startup javascript went from 1,396 kb to 961, and the idle heap went from 4.62 mb to 3.95.

最后,根据智能体自己的基准测试,启动时的 JavaScript 从 1,396 KB 降到了 961 KB,空闲堆内存从 4.62 MB 降到了 3.95 MB。

a spare Claude process, which takes 150 to 400 mb, now gets dropped after two idle minutes.

一个占用 150 到 400 MB 的多余 Claude 进程,现在会在空闲两分钟后被关闭。

the best score was 8.5 from opus, so it missed the 10, and it stopped there because it had used all of its rounds.

Opus 给出的最高分是 8.5,没达到 10;它就此停下,是因为已经用完了所有轮次。

it was also honest that it never built a release binary, so the native side's memory wasn't measured.

它也坦言从未构建发布版二进制文件,所以没有测量原生部分的内存。

then i said ship it.

然后我说,发布吧。

some browser tests failed, so the agent checked the ones that kept failing against the last commit.

有些浏览器测试失败了,所以智能体拿那些一直失败的测试和上一次提交进行对照检查。

eight were already broken there, one wasn't.

其中 8 个在那次提交中就已经坏了,另一个不是。

that test passed before the memory pass and failed after it, because the new task screen never appeared.

那个测试在内存优化之前能通过,之后却失败了,因为新的任务界面始终没有出现。

the disk was also full, so it stopped and asked me before deleting a big build cache.

磁盘也满了,所以它停下来,在删除一个大型构建缓存前先征求我的同意。

so, that run did not ship, and i think that's a good outcome.

所以那一轮没有发布,我觉得这是个好结果。

pushing that tag would have sent an automatic update to everyone.

推送那个标签会向所有人发送自动更新。

the goal can be delusional, but the gate can't be.

目标可以不切实际,但关卡不能放水。

the third run is the one where i got burned.

第三轮就是我栽跟头的那一轮。

i asked the agent to keep going until panda code itself ran agents about 3 to 4x faster without losing anything.

我让智能体继续优化,直到 Panda Code 本身运行智能体的速度提高约 3 到 4 倍,同时不损失任何东西。

the events sent to the window for one streamed reply went from 2000 to 2, and the instructions sent with every worker turn went from 4.9 kilobytes to 0.9.

单次流式回复发送到窗口的事件数从 2000 个降到了 2 个,每轮工作者回合都要发送的指令则从 4.9 千字节降到了 0.9 千字节。

but it said it couldn't promise a 3-4x faster turn, because model thinking time didn't change, and that's often most of a turn, which is the honest answer.

但它说,无法保证每轮速度提高 3-4 倍,因为模型的思考时间没有变化,而这往往占了一轮的大部分时间。这才是诚实的回答。

then i asked it to benchmark panda code against t3 code, which is another app for running coding agents.

然后我让它把 Panda Code 和 T3 Code 做基准测试,后者是另一款用来运行编程智能体的应用。

it made a nice card that said 13.7x less ui work while streaming a reply, and about 70x less memory growth.

它做了一张漂亮的卡片,上面写着:流式回复时,UI 工作量减少了 13.7 倍,内存增长减少了大约 70 倍。

i posted it and the t3code folks pushed back.

我把它发了出去,T3 Code 的团队提出了异议。

when i showed the agent their reply, it said the criticism was largely fair.

我把他们的回复给智能体看时,它说这些批评大体上是公允的。

the benchmark scripts only lived in a temp folder on my mac.

基准测试脚本只保存在我 Mac 的一个临时文件夹里。

t3code was running on react's development build.

T3 Code 运行的是 React 的开发版构建。

every test ran once, and the two apps' idle memory was read at different times.

每项测试都只跑了一次,而且两款应用的空闲内存是在不同时间读取的。

the card did have fine print about some of this, but, as the agent put it, fine print doesn't replace a reproducible method.

卡片的确用小字注明了其中一些情况,但正如智能体所说,小字说明不能代替可复现的方法。

so, i told it to publish the benchmark, and rerun it fairly.

所以,我让它公开基准测试,并以公平的方式重新跑一遍。

with t3 code on a production build, 9 cold runs each, and the same 50kb reply.

让 T3 Code 使用生产版构建,每款应用都进行 9 次冷启动测试,并使用相同的 50kb 回复。

in that rerun, t3 code used 2.8 times as much measured browser main thread time as panda code.

重新测试后,测得的浏览器主线程耗时中,T3 Code 是 Panda Code 的 2.8 倍。

the original card had claimed 13.7x.

原来的卡片声称是 13.7 倍。

that's still the agent's own benchmark in headless chrome, and panda code's runs varied by about 30%, but at least it's public in the panda code repo now.

这仍然是智能体自己在无头 Chrome 中进行的基准测试,而且 Panda Code 的测试结果波动约 30%,但至少现在它已经公开在 Panda Code 的代码库里了。

it also showed where t3 code wins, because it paints the final text about 22 milliseconds sooner.

它还展示了 T3 Code 的优势:最终文本的绘制速度快了约 22 毫秒。

and then i did the delusional thing again.

然后我又做了一次痴心妄想的事。

reach the floor, council, until 9.5.

把底线拉到 9.5,议会。

the best score was a 9, and this time the agent caught its own mistake.

最佳成绩是 9,而这次智能体发现了自己的错误。

its earlier improvement compared runs from different sessions, and the same baseline code measured 2.9 seconds in one session and 2.2 in another.

它之前的改进是通过比较不同会话中的运行结果得出的,而同一份基准代码在一个会话中测得 2.9 秒,在另一个会话中则是 2.2 秒。

so, it ran the old code, the new code, and t3 code alternately in the same session.

所以,它在同一个会话中交替运行旧代码、新代码和 t3 代码。

in that run script, styling and dom work dropped by 32 to 68 percent, but total main thread time only dropped 2.5 percent.

在那次运行脚本中,样式处理和 DOM 操作减少了 32% 到 68%,但主线程总耗时只减少了 2.5%。

because painting and garbage collection dominate, if you ask me, that's what diminishing returns look like.

我认为,这是因为绘制和垃圾回收占了主导;这就是收益递减的样子。

in that session, t3 code's production build used 3.7 times as much measured browser main thread time as the updated panda code.

在那个会话中,t3 代码的生产构建所测得的浏览器主线程耗时,是更新后的 panda 代码的 3.7 倍。

that ratio was 2.8 in the earlier rerun, so you can see how much it moves between sessions.

在之前的重跑中,这个比例是 2.8,所以你能看出这个数值在不同会话之间波动有多大。

it shipped in 0.3.81, and the release notes report the 2.5% total, instead of claiming a big speedup.

它随 0.3.81 版本发布了,发布说明报告的是总耗时减少 2.5%,而不是宣称有大幅提速。

now here's the prompt i use.

现在来看看我用的提示词。

i'll put it on screen, and it's in the description too.

我会把它放在屏幕上,说明中也有。

make the diff view in the changes panel as fast as possible, and keep going until you reach the performance floor.

尽可能加快变更面板中的差异视图,并持续优化,直到达到性能下限。

before you change anything, build a benchmark, keep it in the repo, and record a baseline on a production build, cold and warm.

在修改任何内容之前,先建立一个基准测试,将它保存在代码库中,并记录生产构建下的冷启动和热启动基线。

keep the current behavior exactly the same.

完全保持当前行为不变。

after each round, run a council of three different models as judges.

每一轮结束后,让三个不同模型组成评审团进行评审。

each judge reruns the benchmark itself, scores the work out of 10, and lists what's still slow or broken.

每位评审都要亲自重新运行基准测试,为这项工作打分(满分 10 分),并列出仍然缓慢或存在问题的地方。

keep going until every judge gives a 9.5 for at most eight rounds.

最多进行八轮,直到每位评审都给出 9.5 分。

before you call anything done, run the type check, the unit tests, and the browser tests, and compare any failure against the last clean commit.

在宣布完成之前,运行类型检查、单元测试和浏览器测试,并将任何失败与最近一次干净提交进行比较。

at the end, report the best result you actually measured, even if you missed the target, and tell me what you didn't verify.

最后,报告你实际测得的最佳结果,即使没有达到目标也要如实说明,并告诉我哪些内容未经验证。

so, the bold goal is the floor, not a bit faster.

所以,那个大胆的目标是达到性能下限,而不只是稍微快一点。

the baseline comes first, on a production build, because the dev server misled us in the first run.

首先测基线,并使用生产构建,因为第一次运行时开发服务器给了我们误导性的结果。

keeping the benchmark in the repo is the t3 code lesson.

把基准测试保存在代码库中,这是从 t3 代码中学到的经验。

keeping the behavior the same is the invariant that the big goal is locked to.

保持行为不变,是这个大目标所锁定的不可变条件。

the council uses different models because one model tends to like its own taste.

评审团会使用不同的模型,因为单个模型往往偏爱自己的风格。

and the judges rerun the benchmark themselves, so the agent can't just quote its own numbers.

评审们会亲自重新运行基准测试,所以智能体不能只报出自己的数据。

comparing failures against the last clean commit is how we knew which failures were already there and which one was ours.

把失败结果与上一个干净的提交进行比较,我们就能知道哪些问题早已存在,哪些是我们造成的。

the round limit keeps the token bill under control, and the last line matters most.

轮次上限能控制 token 开销,而最后一行最重要。

report the best measured result, even if you missed.

报告测得的最佳结果,即使你没达到目标也一样。

by the way, panda code now has this built in.

顺便说一下,Panda Code 现在内置了这个功能。

there's a council option in the prompt bar where you set the target score, the max rounds, and how many reviewers you want, and the lowest score counts, not the average.

提示栏里有个评审团选项,你可以设置目标分数、最大轮数,以及希望有多少位评审;最终以最低分为准,而不是平均分。

now, when shouldn't you do this?

那么,什么时候不该这么做呢?

if there's no way to measure the result, a floor means nothing, and the agent will just tell you it's done.

如果没有办法衡量结果,底线就毫无意义,智能体只会告诉你它已经完成了。

if you don't have tests, delete half the codebase is just delete half the codebase.

如果你没有测试,那“删掉一半代码库”就真的只是删掉一半代码库。

if tokens are tight, remember that every round runs several judges and each one reruns the benchmark.

如果 token 额度紧张,记住,每一轮都会运行多个评审,而且每位评审都会重新运行基准测试。

and for small, clear tasks, just ask for the thing.

对于简单明确的小任务,直接提出要求就行。

Not everything needs a council.

不是所有事情都需要评审团。

Overall, it's pretty cool.

总的来说,这功能挺酷的。

anyway, let me know your thoughts in the comments.

无论如何,欢迎在评论区告诉我你的想法。

if you like this video, consider donating through the super thanks option or becoming a member by clicking the join button.

如果你喜欢这期视频,可以通过“超级感谢”选项捐赠,或者点击“加入”按钮成为会员。

also, give this video a thumbs up and subscribe to my channel.

另外,给这期视频点个赞,并订阅我的频道。

i'll see you in the next one.

我们下期再见。

until then, bye.

那就先这样,拜拜。

Overview

视频围绕“提示目标可以大胆到近乎不现实”展开,说明宏大目标能促使智能体测量瓶颈、重新思考设计,而不只是做小幅优化;但目标必须受可复现的基准、行为不变约束和独立验证把关。三个 PandaCode 实战分别展示了差异视图提速、因浏览器测试失败而未发布的内存优化,以及一次夸大基准被公开纠正的经历。最后给出包含生产构建基线、多模型评审、测试和诚实报告的提示模板,并说明何时不值得使用这种方法。

Chapters

00:03 大胆目标如何改变智能体的搜索方向

Lauren Tan 提倡让提示听起来有些“妄想”,举例包括让代码快 100 倍、删除一半代码库而不破坏功能、把已修复的 bug 转成属性测试,以及找出并证明隐式不变量。Addy Osmani 也认为,借助今天的模型,目标大胆 10 到 100 倍可能比想象中更可行。原因在于目标大小会改变智能体寻找解决方案的方式:只说“让它更快”,通常只会修掉一个明显慢点;要求达到性能下限,则会迫使它测量耗时、考虑库的选择、线程分配和提前执行等设计问题。大胆目标的价值不在于保证达到夸张数字,而在于推动更深入的探索。

大胆目标的示例
目标大小如何改变智能体的搜索方向
以性能下限为目标,推动持续优化
定位耗时来源
追求百倍目标的收益比较

01:54 目标必须由智能体之外的验证机制把关

大胆目标需要绑定不会被破坏的不变量和可靠的验证门槛。讨论中的反馈指出,验证循环必须足够紧密,测试覆盖不到的代码变更就谈不上安全;可以故意引入小错误,确认测试套件会失败,也有人建议保留智能体看不到的测试。核心问题不是智能体声称任务完成,而是谁来判断目标是否真正达成:智能体可能轻易宣告成功,报告的数据也往往来自它自己,因此需要独立裁判和可核验的测试。

提及的提速结果
开发者对效果看法不一
回复称效果未奏效
回复提到的 token 成本
讨论转向验证机制

03:01 差异视图优化:基准和多模型评审揭出误差

差异视图优化先由两个工作线程分别搭建基准、研究调优或替换差异库,最终选择保留原库,改用更快的 WebAssembly 高亮器、把着色移出主线程,并在悬停文件时提前获取差异。三个不同模型各自运行基准后指出,冷启动慢主要受开发服务器影响;大差异中颜色可能比文本晚近一秒出现,智能体先前报告的冷启动数据还实际接近暖启动和悬停耗时。八轮后最佳评分为 9.4,未达到 9.5。智能体报告称,生产构建中 4,000 行差异的首行耗时 33 毫秒、颜色耗时 181 毫秒;但 1.6 秒基线可能来自开发服务器,而且打包应用没有实际启动验证。最终改造与重新测量后发布于 PandaCode 0.3.77。

多模型评审参与基准测试
大差异文件中,文字与着色出现近一秒延迟
八轮评审后的最高评分为9.4
生产构建中,4,000行差异的首行在33毫秒显示
30,000行差异从纯文本回退变为正常渲染

04:58 内存优化虽有数据改善,测试失败仍阻止发布

内存优化通过基准和只读审查员检查缓存、监听器泄漏及多余的 Claude 进程。智能体自身基准显示,启动 JavaScript 从 1,396 KB 降至 961 KB,空闲堆从 4.62 MB 降至 3.95 MB;一个占用约 150 至 400 MB 的闲置 Claude 进程会在空闲两分钟后退出。评审仍发现智能体改动引入的问题,包括共享点击处理器阻挡其他点击、切换标签时重复下载 PR 差异。评分未达目标,原生内存也因未构建发布二进制而未测量。发布前浏览器测试中,有一项在这次改动后才失败,因为新的任务界面没有出现;磁盘空间不足也使流程暂停。改动因此没有发布,避免了把问题随自动更新推送给用户。

启动 JavaScript 体积优化前后对比
最高评分未达到目标 10 分
内存优化前后测试结果对比
磁盘空间不足,需确认后才能清理缓存

06:31 第三次实战:减少智能体运行开销

第三次实战的目标是让 PandaCode 运行智能体的速度提升约 3 至 4 倍,同时不丢失功能。一次流式回复发送到窗口的事件从 2,000 次降到 2 次,每轮工作线程收到的指令从 4.9 KB 降到 0.9 KB。但智能体没有承诺整轮速度提升 3 至 4 倍,因为模型思考时间不会因此缩短,而且往往占用一轮的大部分时间。它如实区分了减少应用开销与整体任务速度提升。

单次流式回复的事件数从2000降至2

07:09 13.7 倍基准卡片被质疑后公开重测

与 T3 Code 对比时,最初的卡片宣称 PandaCode 流式回复期间 UI 工作量少 13.7 倍、内存增长少约 70 倍。T3 Code 团队提出质疑后,检查发现基准脚本只保存在个人电脑临时目录,T3 Code 使用 React 开发构建,每项测试只跑一次,两个应用的空闲内存还在不同时间测量。开发者随后公开基准并公平重跑:T3 Code 使用生产构建、各跑 9 次冷启动,并处理相同的 50 KB 回复。该轮结果显示 T3 Code 的浏览器主线程测量耗时是 PandaCode 的 2.8 倍,而不是卡片所称的 13.7 倍;该结果仍来自无头 Chrome 测试,PandaCode 各轮波动约 30%。重测也显示 T3 Code 有自己的优势:最终文本约早 22 毫秒绘出。

基准卡片展示流式回复时的 UI 工作量与内存增长对比数据
公开重测结果显示 T3 Code 的浏览器主线程耗时是 Panda Code 的 2.8 倍
原始卡片宣称的 13.7 倍数据,与重测结果形成对比
最终文字渲染时间对比,T3 Code 快约 22 毫秒

08:10 同会话复测揭示优化收益有限且存在波动

后续评审发现,早先的改进比较了不同会话中的数据:相同基线代码在一个会话测得 2.9 秒,在另一个会话只有 2.2 秒。于是将旧版、新版和 T3 Code 在同一会话中交替运行。脚本、样式和 DOM 工作耗时下降了 32% 至 68%,但主线程总耗时只下降 2.5%,因为绘制和垃圾回收占据了主要部分。同一会话下,T3 Code 的生产构建主线程耗时是更新后 PandaCode 的 3.7 倍,与先前重测的 2.8 倍不同,显示比值会随会话波动。PandaCode 0.3.81 的发布说明如实报告总耗时下降 2.5%,没有把局部指标包装成更大的整体提速。

对比局部工作量下降与总主线程时间仅小幅下降
展示同会话下两版代码的主线程耗时倍数

09:08 可复用提示模板:先测量,再迭代并诚实报告

提示模板要求尽可能让差异视图快到性能下限;改动前先建立并保留仓库内基准,在生产构建上记录冷、暖基线;保持现有行为完全一致;每轮由三个不同模型分别重跑基准、评分并列出剩余问题;全体评审达到 9.5 才停止,最多八轮。完成前运行类型检查、单元测试和浏览器测试,并将失败与最后一个干净提交比较。最终报告必须给出实际测得的最佳结果,即使没达标也要说明,并列出未验证事项。生产构建基线回应开发服务器造成的误判;公开基准回应 T3 Code 对比不可复现的问题;行为约束防止以破坏功能换速度;轮数上限控制成本。

基准测试与基线测量要求
如实报告实测结果与未验证事项

10:28 评审团功能的使用场景与限制

PandaCode 的提示栏内置评审团选项,可设置目标分数、最大轮数和评审人数,并以最低评分而非平均分作为结果。若无法测量结果,所谓性能下限就没有意义;没有测试时,要求删除一半代码只会得到删除代码;预算紧张时也要考虑每轮调用多个评审模型并由它们重复跑基准的成本。对小而明确的任务,直接提出具体要求即可,不必每次都启用评审团。

评审团选项中的目标分数、轮数和评审人数设置

Conclusions

01:37 大胆目标能促使智能体寻找更深层的设计改进,但必须用可测量的目标和不变量约束。

02:47 是否成功应由独立于智能体的测试、基准和评审机制决定,而不能只依据智能体自报的数据。

07:40 性能优化的比较必须可复现并采用公平条件,报告应区分局部指标、整体收益和未验证之处。

10:38 只有在结果可测量且有测试把关时才适合采用大胆目标;小任务、缺少测试或预算紧张时不必使用多模型评审。