Microsoft's Secret 90s Weapon That Made Windows Fast

Share

Summary

Dave Plamer, a retired operating systems engineer from Microsoft, reveals a secret optimization tool called BBT (Binary Basic Block Tools), nicknamed Lego, used in the 90s to improve the performance of Microsoft products like Windows and Office. This tool optimized binaries after compilation and linking, making programs faster, smaller, and more memory-efficient without touching the source code. BBT achieved this by rearranging basic blocks of code based on execution profiles to improve memory locality and reduce working set size, a crucial factor in an era of limited RAM.

Highlights

The Invisible Impact of Optimization
00:14:31

BBT highlights that the most impactful optimizations are often not glamorous or highly visible. Users didn't know BBT existed; they just noticed their machines felt faster and more stable. This 'invisible' improvement represents the highest form of systems engineering, leading to millions of machines performing more efficiently without explicit user awareness.

Introduction to Microsoft's Secret Optimization Tool: BBT (Lego)
00:00:00

Dave Plamer introduces BBT, a clandestine optimization tool from his Microsoft days. This tool, also known as Lego, worked on binaries after compilation and linking, secretly enhancing performance by rearranging code without developer intervention. This practice was unknown outside Microsoft for nearly 30 years.

The Problem of Memory Limitations in the 90s
00:01:38

In the 90s, memory was a critical constraint. Operating systems like Windows NT4 and Windows 95, along with applications like Office, were growing in size and complexity, but hardware was limited. Machines often had as little as 12 megabytes of RAM, making memory efficiency paramount to avoid performance bottlenecks like excessive swapping.

How BBT Optimized Binaries Beyond Compiler and Linker
00:02:32

Unlike compilers and linkers that operate on source code and object files, BBT intervened at the binary level. It treated basic blocks of machine instructions like 'Lego bricks,' rearranging them based on actual execution profiles. This allowed commonly executed code paths to be grouped together, improving memory locality and reducing the working set size.

The Working Set and Its Impact on Performance
00:03:48

The working set refers to the memory pages a process needs to run smoothly. BBT tackled the issue where necessary code was scattered across many memory pages, forcing the OS to load more data than required. By clustering 'hot' code paths and moving 'cold' or rarely used code away, BBT ensured only essential pages were in RAM, reducing page faults and improving responsiveness.

The BBT Pipeline and Profile-Guided Optimization
00:05:43

The BBT process involved building the program, analyzing the binary to identify basic blocks, instrumenting it or using profile data from representative runs to understand execution patterns, and then rebuilding the executable's layout. The effectiveness of this profile-guided optimization heavily depended on 'representative' workloads for training, as optimizing for the wrong scenario could yield poor results.

Challenges and Complexity of Binary Rewriting
00:11:01

Rewriting binaries safely is extremely complex. It involves meticulously managing entries, import/export tables, relocation records, exception metadata, and debug symbols. Any error could lead to crashes in specific, hard-to-debug scenarios. Microsoft's unique resources and build discipline allowed them to manage this risk effectively.

Binary Layout as a User Interface and Modern Relevance
00:12:57

Plamer emphasizes that binary layout directly impacts the user experience. By optimizing how code was arranged in memory, BBT made applications feel faster and more responsive, indirectly improving the "user interface." This principle of locality remains crucial today, as seen in modern tools like LLVM's Bolt and Propeller, despite advancements in hardware.

Recently Summarized Articles

Loading...