HackerTubewatch
Surprise me
Frame from FIXING the ENTIRE SM64 Source Code (INSANE N64 performance) Plays via YouTube's privacy-enhanced embed

FIXING the ENTIRE SM64 Source Code (INSANE N64 performance)

Kaze Emanuar
Explainers
YouTube
7 HN users recommended this explainer7 months2022–2025 score 8
Years with an HN recommendation, 2007–2026

HN loves the deep, hands-on look at N64 hardware quirks such as bus contention and the surprisingly large wins from low-hanging optimizations.

Kaze Emanuar explains how he rewrote and optimized the Super Mario 64 source code so it runs far faster on real N64 hardware. He covers performance bottlenecks and fixes in detail for his ROM hacks.

“amazing video about refactoring Mario 64 to reach 30 FPS and render 6x faster on N64” (HN, 2024)

2 strong recommendations · 6 recommendations · 10 citations · 1 critical · Explainers · advanced

19 Hacker News comments

From the HN archive; up to 20 kept per video, favoring different commenters. Recommendations first.

@CSMastermind Jan 2024 Strongly recommends
on HN thread Decompilation of Paper Mario for N64
There's an amazing video about refactoring Mario 64 to reach 30 FPS and render 6x faster on N64: [this video] The changes were much more extensive than just removing the debug flags. They were also able to get local coop and a 4 player split screen working which were features originally intended for the game but cut for performance reasons.
Refactoring Mario 64 for 30 FPS and split-screen co-op
@alpaca128 Feb 2024 Strongly recommends
on HN thread How video games use lookup tables
Not always, though it might depend on what platform you mean with retro. Kaze Emanuar on YT does a lot of development for the N64 and it feels like half the time he talks about how the memory bus affects all kinds of optimizations. In Mario 64 he replaced the original lookup table for the sine function because an approximation was faster and accurate enough (or rather two approximations for two different purposes). I love that channel, he reworked the entire Mario 64 code [0] to make it run at stable 60FPS...because he wanted his mods to run faster. [0] [this video]
Reworked Mario 64 code for stable 60FPS
@MarioMan Jan 2023 Recommends
on HN thread Nintendo 64 Java
On a related note, Kaze has done a deep dive into optimizing the Super Mario 64 source code for his ROM hacks. Here’s one of his more popular videos on the subject: [this video]
Deep dive into optimizing Super Mario 64 source
@rdlw Oct 2023 Recommends
on HN thread The Worlds First FPGA N64
If anyone is interested in new projects for N64 hardware, Kaze Emanuar has an amazing series about optimizing Super Mario 64 to run incredibly complex romhacks on original hardware. Interestingly, SM64 is usually throttled by memory speed. This means that using 'inline' is detrimental to performance, since making the program larger can cause another read from memory. Here's an overview video, he has many more specific videos about specific topics: [this video]
Overview of optimizing Super Mario 64 for complex romhacks
@Wolfbeta Jan 2024 Recommends
on HN thread Super Mario 64 on the Web
I've recently been enjoying watching this young modder on YouTube optimize all of the original SM64 source code, doubling frame rate, and modding his own Return To Yoshi's Island [this video]
Modder optimizing SM64 source to double frame rate
@Apofis Apr 2024 Recommends
on HN thread I ported thousands of apps to Windows 95 [video]
If you found the video on Super Mario 64 being published with debug symbols interesting, check this out: After finding out about the debug symbols, a developer took a deeper dive through the codebase and optimized the ever living hell out of to get 60fps+. FIXING the ENTIRE SM64 Source Code (INSANE N64 performance) [this video]
Developer optimized SM64 code to 60fps+

Citations, criticism and jokes

@Thaxll Jun 2022 Cites it
on HN thread Quake on the Game Boy Advance [video]
Are modern compiler good enough / have good optimization on old hardware so that you don't need to write ASM? I remember that impressive opti on Mario64 and it's using C / GCC: [this video]
Impressive optimization of Mario 64 in C
@kibwen Jun 2023 Cites it
on HN thread Finding the best sine function for Nintendo 64
Kaze has already done so, and picking the low-hanging fruit results in much greater improvements than the optimizations shown here (which frees up less than one millisecond per frame). Here's the previous video with explanations and video demonstration of their improvements: [this video]
Low-hanging optimizations with demonstrated improvements
@phire Jun 2023 Cites it
on HN thread Finding the best sine function for Nintendo 64
Read more
In one of Kaze's older videos [1] , he tracks both CPU and RCP time over various optimisations. The numbers make it pretty apparent that you can get significant RDP performance gains by reducing the amount of CPU bandwidth and/or improving it's access locality. The N64 is a unified memory system, and memory stalls triggered by the CPU will slow RDP down. The N64's memory controller appears to be very simple. As I understand it, if one sub-component attempts to access a DRAM row that is closed (DRAM rows are 2KB long), then the entire memory controller stalls for ~100ns as the RDRAM chip closes the previous row (writing out any dirty changes) and opens the new row. The controller doesn't appear to do any reordering to optimise access patterns. If multiple components are accessing the same 1MB bank simultaneously, you can hit pathological bad cases were the entire system slows down, as the memory controller is continually stalling for 100ns at a time while the memory chips close and reopen rows. Which is why some games can enable a high resolution mode when the memory expansion pack is present. They often don't need the extra 4MB of ram, but simply being able to strategically spread their data across eight different banks instead of four banks can massively improve performance. [1] [this video]
Tracks CPU and RCP time across optimizations
@echelon Mar 2024 Cites it
on HN thread VR Powered by N64 [video]
This is what James Lambert does as a follow up when Valve shuts down [1] his "Portal in N64" project [2]. James is like Kaze [3] and builds incredible N64 demos [4] and technical videos about them. [1] [link] [2] [link] [3] [this video] [4] [link]
Creator of incredible N64 demos and technical videos
@Manuel_D Dec 2024 Cites it
on HN thread Programming the C64 with Visual Studio Code
Retro game coders achieve some pretty astounding results sometimes. One of my favorite examples is one who optimized super Mario 64 to such a degree that it runs with much better framerate on the original hardware. Also, multiplayer was added: [this video]
Mario 64 optimized to run better on original hardware
@01HNNWZ0MV43FF Feb 2025 Cites it
on HN thread RT64: N64 graphics renderer in emulators and native ports
For those who haven't heard, Kaze is the guy who optimized Mario 64's code, fixed some physics bugs, etc., claims roughly 6x speedup, so that he can make a mod / ROM-hack that runs smoother despite having better graphics: [this video]
Mario 64 code optimization claiming roughly 6x speedup
@phire May 2025 Cites it
on HN thread Palette lighting tricks on the Nintendo 64
Read more
Both use a unified memory architecture, where the GPU and CPU share the same pool of memory. On the N64, the CPU always ends up bottlenecked by memory latency. The RAM latency is quite high to start with, your CPU is sitting idle for ~40 cycles if it ever misses the cache, assuming RCP is idle. If RCP is not idle, contention with can sometimes push that well over 150 cycles. Kaze Emanuar has a bunch of videos (like this one [this video] ) going into detail about this flaw. The gamecube fixed this flaw in multiple ways. They picked a CPU with a much better cache subsystem. The PowerPC 750 had Multi-way caches instead of a direct mapped, and a quite large L2 cache. Their customisations added special instructions to stream graphics commands without polluting the caches, resulting in way less cache misses. And when it did cache miss, the latency to main memory is under 20 cycles (despite the Gamecube's CPU running at 5x the clock speed). The engineers picked main memory that was super low latency. To fix the issue of bus contention, they created a complex bus arbitration scheme and gave CPU reads the highest priority. The gamecube also has much less traffic on the bus to start with, because many components were moved out of the unified memory. --------------------------- The N64 famously had only 4KB of TMEM (texture memory). Textures had to fit in just 4KB, and to enable mipmapping, they had to fit in half that. This lead to most games on the N64 using very small textures stretched o
Details N64 memory bus contention flaws
@haiku2077 Jul 2025 Cites it
on HN thread I Ported SAP to a 1976 CPU. It Wasn't That Slow
> Lookup tables are always faster than calculation - is that true? I know it's not always true on the Nintendo 64, because it shared a single bus between the RAM and "GPU": [this video] , [link]
Lookup tables slower on N64 due to shared bus

Video list and Hacker News comment labels from HackerTube (prompted by @karpathy), released under ODC-By 1.0, built on the open-index/hacker-news archive. Hacker News data is provided by Y Combinator; comments remain the work of their authors. Video titles, channel names and thumbnails belong to their creators and are shown via YouTube. HackerTube Watch is an unofficial edition. Data export of 2026-10-31.

Keyboard shortcuts

/
Search
j k
Next / previous video
r
Surprise me
l
Like (video page)
w
Watch later (video page)
?
This help
Esc
Close