TONT 42203 为什么任务栏上的时钟不显示秒?

喵。

原文链接:https://blogs.msdn.microsoft.com/oldnewthing/20031010-00/?p=42203

Early beta versions of the taskbar clock did display seconds, and it even blinked the colon like some clocks do. But we had to remove it.

在早期测试版中,任务栏上的时钟的确显示过秒,甚至还像一些真的电子表一样闪动着分隔的冒号,但到头来我们还是把它移除了。

Why?

为什么呢?

Because that blinking colon and the constantly-updating time were killing our benchmark numbers.

因为闪烁的冒号和一直更新的时间对性能评估分数有重大影响。

On machines with only 4MB of memory (which was the minimum memory requirement for Windows 95), saving even 4K of memory had a perceptible impact on benchmarks. By blinking the clock every second, this prevented not only the codepaths related to text rendering from ever being paged out, it also prevented the taskbar’s window procedure from being paged out, plus the memory for stacks and data, plus all the context structures related to the Explorer process. Add up all the memory that was being forced continuously present, and you had significantly more than 4K.

在只有4MB内存的机器上(这是Windows 95的最低内存需求),就算只是节约4KB内存也对性能评估分数有可感知的影响。如果每秒钟都闪烁一下时钟,这种做法不仅阻止了有关文本渲染的代码链被出页(译注:从内存页中移除,也就是相关代码被从内存中卸载的意思),也组织了任务栏所在窗口进程被出页,还有与之相关的栈和数据内存,外加与资源管理器相关的所有上下文结构被出页。把所有这些(由于任务栏上的时钟会闪烁而导致的)内存加起来,可比4K要多多了。

So out it went, and our benchmark numbers improved. The fastest code is code that doesn’t run.

最终这块代码被移除,而性能评估分数也得到了提升。最快的代码乃是不运行的代码。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

 剩余字数 ( Characters available )

Your comment will be available after auditing.
您的评论将在通过审核后显示。

Please DO NOT add any links in your comment, otherwise it would be identified as SPAM automatically and never be audited.
请不要在评论中插入任何链接,否则将被自动归类为垃圾评论,且永远不会被提交给博主进行复审。

*