跳到正文
Hacker News· speckx·· 5 天前AI 评分10

程序性能随使用时长下降:Rust 程序变慢与 LLM 重写效果减弱

Program Performance Degrades with Usage

AI 导读

一位开发者发现其 Rust 命令行程序在一天中会逐渐变慢,基准测试结果无论如何都变差,原因很可能是 Linux 系统整体资源占用,而非程序本身。由于程序使用大块 mmap,一旦进入这一状态,基准测试基本等同于在测操作系统,继续用 Rust 优化代码已不值得,因此他将不再重视基于 LLM 的 Rust 重写,因为其已无法带来可测量的差异。

正文 · 原文

Oct 12, 2026

One thing I have noticed recently, when trying to improve my Rust program, is that it tends to become progressively slower over the course of a day. If I am trying to benchmark something, it seems like no matter what I do, it becomes slower.

Program Performance

It seems likely that given my program is not running continuously, and is run as a command-line program, the slowdown is due to general resource usage on the computer. The program uses a large mmap so this relies on many sub-systems in Linux.

In any case, once a program reaches this point, a benchmark of the program mostly is a benchmark of the OS. Further code optimization in Rust is not worthwhile. So to put it bluntly, I will de-emphasize my LLM-based Rust rewrites, as they are no longer making a measurable difference.

来源:Hacker News · dotnetperls.com