news.volyx.in

The time the x86 emulator team found code so bad they fixed it during emulation (devblogs.microsoft.com)

504 points by paulmooreparks · 74 days ago · 173 comments on HN

Article summary

The article tells the story of an x86 emulator team that found a program with extremely inefficient code, which initialized 64KB of memory using 256KB of code. The team was so offended by the code that they added a special fix to the emulator to replace the inefficient code with a more efficient loop. This story highlights the challenges of dealing with poorly optimized code and the creative solutions that developers may employ to work around such issues. The article also touches on the history of Windows and its support for different processor architectures.

Main themes

  • Code optimization
  • Emulation and translation
  • Processor architecture
  • Software development
  • Windows history

What commenters say

  • Some commenters suggest that the practice of including workarounds for poorly optimized code in drivers and emulators is a common and necessary evil in the gaming industry.
  • Others argue that this approach can lead to fragile and inefficient solutions that may cause problems for other applications or games.
  • There is disagreement about whether the use of executable names to detect and optimize for specific games is a legitimate or problematic practice.
  • Some commenters note that the use of special case optimizations to fix poorly optimized code can be seen as a form of 'gaming' the system, and that a more robust solution would be to improve the underlying code or provide more general optimizations.
  • The discussion also touches on the history of Windows and its support for different processor architectures, with some commenters speculating about the native architecture in question.
  • Others point out that the problem of poorly optimized code is not unique to the gaming industry, and that similar issues can be found in other areas of software development.
  • There is also a discussion about the role of drivers and emulators in providing workarounds for poorly optimized code, and whether this is a necessary or desirable practice.
  • Some commenters argue that the use of emulation and translation layers can provide a good opportunity to include workarounds for poorly optimized code, and that this can be a useful solution in certain cases.