Measure startup without fooling yourself / 怎么测启动时间,才不会把误差当提升

← Blog / 博客 · Sunrising dev ·

Measure startup without fooling yourself

Performance / 性能

Pick a finish line

A window appearing is not the same as an app being ready. For a text editor, time from clicking the icon to the first character appearing in a blank document. For a photo viewer, stop when a particular photo is sharp and you can advance to the next one. Write down the finish line before testing.

Compare like with like

Keep the same file, power mode and app version. Record the first launch after a restart separately from later launches. If you change a startup option, alternate the old and new settings over several runs. A screen recording makes it easier to spot the same start and finish in each run.

Read the spread, not the fastest run

Suppose your original runs take 3.0, 3.2 and 4.5 seconds, and the new runs take 3.1, 3.2 and 3.4. Both medians are 3.2 seconds. The new setting had a shorter worst run in this sample; that is not evidence of a faster typical launch. Keep the individual times and repeat before recommending the change.

怎么测启动时间,才不会把误差当提升

Performance / 性能

先定终点

窗口出现不等于应用可用。测编辑器,可以从点击图标开始,到空文档中能打出第一个字为止;测看图工具,就等同一张照片清晰显示且能切到下一张。先写下终点,再开始计时。

不要把两种启动混在一起

固定文件、电源模式和软件版本。重启后的第一次启动单独记,别和随后几次取平均。调整启动选项后,交替测试原设置和新设置。录屏后逐次找同一个起点和终点,比边操作边按秒表更容易复查。

看波动,不只看最快一次

假设原设置三次为 3.0、3.2、4.5 秒,新设置为 3.1、3.2、3.4 秒。两组中位数都是 3.2 秒。最多只能说本轮最慢一次有所改善,不能说典型启动变快了。保留原始记录,下次再测。