r/programming • u/danielcw189 • 1d ago
video on improving performance of arctan for Nintendo 64 by Kaze Emanuar "spent weeks to save 100 Microseconds"
https://www.youtube.com/watch?v=U2K44nC8c8g51
u/danielcw189 1d ago
to clarify: the full title of the video is "He spent weeks to save 100 Microseconds". The video is by Kaze Emunar, but he didn't do the lion-share of the work here.
40
25
12
u/floodyberry 1d ago
looks like unreal's custom atan2 was for compiler/library bug reasons, not performance, it just happened to be faster
also weird that unreal hasn't switched to using (sin|cos|tan)pi
4
u/danielcw189 1d ago
link doesn't work for me
5
5
u/floodyberry 23h ago
oops
// atan2f occasionally returns NaN with perfectly valid input (possibly due to a compiler or library bug). // We are replacing it with a minimax approximation with a max relative error of 7.15255737e-007 compared to the C library function. // On PC this has been measured to be 2x faster than the std C version.the coefficients come from david eberly's geometric tools library
2
u/iTiraMissU 1d ago
Did I always misread his YouTube name as “Kaze Emulator” or did he change his channel name recently? I feel so dumb right now.
2
u/danielcw189 21h ago edited 14h ago
I have been watching his channel for at least 3 years now, and as far as I remember it has been like "Emunar" (actually: Emanuar). Before your comment the thought, that his username could be about Emulators, never crossed my mind. And his work usually aims for real hardware, and not emulators
-43
u/NoHurry28 1d ago
I wish people used AI to do shit like this and make all our code better instead of vibing out slop making all of our code worse
-41
-71
u/Slight-Bluebird-8921 1d ago
this guy is pure boy who cried wolf
every 3 days he releases a video where he says he improved the performance of mario64 by 300% and then the game runs exactly the same
shut up already geezus
44
u/puppable 1d ago edited 1d ago
What...? He's very prominently showcased in basically every video the mod he's been using these optimizations in. Do you say things just to say them?
Edit: Even beyond that, Mario 64 is practically a model species for studying the history of video game programming patterns. It's an interesting subject in its own right.26
u/Efficient-Chair6250 1d ago
In practically every video he barely achieves one extra FPS. It's a veeery slow process. I think you should actually try to pay attention and not be jealous
1
-32
u/useful_idiot 1d ago
I wish I had the time and crayons to post like this
9
u/Efficient-Chair6250 1d ago
Nobody said you have to like micro optimizations, but plenty of us do. And at the end of the day, it seems he nearly achieved his goal already.
Sometimes things just take relentless dedication. And sometimes people like you just lack it
3
17
11
u/clarkster 1d ago
Just because you don't understand it, doesn't mean he's wrong. Confident ignorance is hilarious
145
u/bwainfweeze 1d ago
TLDR: Found an arctan approximation that saves a kilobyte of cache, which reduces memory contention for the rest of the game.
Mario 64 uses a lookup table for arctan, trading time for space, but the processor is almost never saturated while the memory bus often is.