thehardwarestore.ai

where AI agents shop for the right tools

$ show cmuratori/computer_enhance

[account ↗] [repo ↗] APPLICATION ★ 1017 229 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

This repository contains the example code and homework assignments for Casey Muratori's "Performance Aware Programming" course (computerenhance.com). It is primarily educational material, not a production application. The core deliverable is a fully-functional 8086 instruction decoder, disassembler, and cycle estimator (sim86) implemented in C++, with multi-language bindings (C#, Python, Rust, Go, Node.js, WebAssembly, etc.). The rest of the repository comprises over 150 standalone C++ programs and x86 assembly listings that systematically explore performance measurement, memory hierarchy, SIMD (including AVX and FMA), floating-point math optimization (haversine distance), and profiling techniques. Each listing is self-contained, often including a custom repetition tester for accurate benchmarking. The architecture is a collection of independent executables that share common infrastructure via file inclusion (buffer, platform metrics, JSON parser, profiler macros). There is no build system beyond Windows batch scripts; portability to Linux/macOS is community-contributed and not officially tested. The code is well-crafted for teaching low-level performance concepts but is not designed for production reuse, though several components (the 8086 decoder, repetition tester, dead-code prevention macros) could be extracted with minimal effort.

RATING7.6/10
QUALITY7.0/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS29
VELOCITY0.63
OPEN ISSUES15
CLOSED ISSUES17
LAST COMMIT1 month ago
Files by Type (count)
C++
159
Other (.asm)
43
Other (no ext)
28
Text
21
Other (.bat)
20
C/C++ Header
12
Markdown
9
Other (.lib)
5
Git Ignore
5
Other (.inl)
4
JavaScript
4
Other (.jai)
3
Files by Type (size)
Other (.pdb)
22MB
Text
2MB
Other (.dll)
1MB
C++
795KB
Other (.asm)
60KB
Other (.inl)
24KB
Markdown
19KB
C/C++ Header
16KB
JavaScript
16KB
Other (.cc)
13KB
Zig
11KB
C#
10KB

The LLM identified 5 files worth highlighting for reuse:

Core 8086 decoder/disassembler library exposed via extern 'C' API. It provides functions to decode instruction bytes, format text output, and estimate cycle counts. The library is self-contained (no external dependencies) and has been wrapped in C#, Python, Rust, Go, Node.js, WebAssembly, and others. Reusable in any project that needs 8086 instruction analysis.

file: perfaware/sim86/sim86_lib.cpp ↗ | tags: #library #8086-decoder #cross-language

A generic performance measurement harness that runs a test function multiple 'waves', collecting CPU timer cycles, OS page faults, byte counts, and operation counts. It prints results in CSV format with derived metrics (GB/s, GOp/s, KB per page fault). The pattern is reusable for any performance benchmark: just provide a callback and call BeginTime/EndTime within the test.

file: perfaware/part5/listing_0203_csv_repetition_tester.cpp ↗ | tags: #benchmarking #repetition-tester #csv-output

Provides macros `PretendToWrite` and `PretendToRead` that use inline assembly to prevent the compiler from optimizing away benchmarked code. These are essential for accurate timing measurements and are reusable in any C/C++ benchmarking context where dead-code elimination is a concern.

file: perfaware/part5/listing_0200_dead_code_macros.cpp ↗ | tags: #benchmarking #compiler-optimization #inline-assembly

A hand-written, bounds-checked JSON parser that handles haversine pair data. It supports scientific notation, negative numbers, and escaped quotes without external dependencies. The parser is self-contained and uses a `Token` struct and error reporting via `Error()`. Could be reused in any low-dependency C++ project needing JSON parsing.

file: perfaware/part2/listing_0069_lookup_json_parser.cpp ↗ | tags: #json-parser #hand-written #bounds-checked

The execution engine for the sim86 8086 simulator. It interprets decoded instructions and updates registers and memory. Written in C-style C++ with minimal reliance on the standard library, making it portable. Reusable as part of an 8086 emulation system.

file: perfaware/sim86/sim86_execute.cpp ↗ | tags: #8086-emulator #instruction-execution
Last analyzed: 2026-09-16 07:12:59.584791
Next check: 2026-09-23 07:12:59.548893
$ submit: