Tests
- Avg Read - read a 1KB file 100 times calculate the median
- Httperf - series of httperf tests on a 1KB file to evaluate the latency
In the main repo there is a performance_test which is our north star. All it does is send 1KB from the gameboy to the wii and output the time diff.
Baseline: 90ms
Results
Commit Avg Read 1 Conn/Sec 5 Conn/Sec 10 Conn/Sec 20 Conn/Sec 669bcfa got reading/writing to actually work 385 314 2543 9851 25701 c4a38c0 remove tte_write / disable vblank 305 255 1139 6952 18709 206c753 remove snprintf calls from gba 266 224 323 5307 15404 e814035 packet - send 3 bytes instead of 2 193 163 149 2471 9678 7f05b15 packet - send 31 bits at a time 147 128 116 726 6290 037c5cf fix bug in 31 bit sending 151 - - - - 1000a89 decrease delay to 30us 141 122 111 455 5754 19fd497 send 32bits at a time 126 118 105 108 4832
Thoughts
2026-11-17
I finally figured out how to fix the misfire bug detailed below. This LinkCube library uses an outgoing queue, and calling send() adds to the queue. The misfire only happens if you try to enqueue at the exact same time that the wii requests data.
So instead of trying to send the entire response 4-bytes at a time, I built a method in LinkCube that does a memcpy of the whole message into the queue, and prepends the message with a MSG_READY identifier. Now the wii just has to check for misfires while waiting for MSG_READY, and once we are ready we can get whole word messages.
Also I tried and failed my first attempt at puffs_cc. I will need to keep digging on that front and probably do some soul searching.
2026-10-20
I am still looking and finding some quick wins. The delay is how long to wait (in microseconds) before making the ioctl call and sending the request to the gba. The legend FIX94 suggests 50us so who am I to think I can be faster?
Well devkitPro interfaces directly with the hardware to implement the delay. Mine is in userspace and I am rolling the dice here that the overhead there is likely longer than the 50us. In fact when I try to set it to something lower than 30us I do not see any overrun/ underrun errors on the line. Things hang because it does not appear to give the gba enough time to get a word in and we see the same all zero's issue described below.
2026-09-02
I am really happy with this first batch of improvements to the read performance of the Puffboy. A 60% decrease in the single reads, and a 75% decrease in performance at 20 connections/sec.
The big changes are all around how data is sent across the wire. There is a big constraint with the library that I am using to send data from the GBA to the Wii:
\warning If the other end asks for data at the same time you call this method, a `0x00000000` will be sent.
Based on the timing it is possible the Wii receives all zeros instead of the expected response. That makes it impossible to separate a misfire from an actual expected 0.
The solution has evolved over time, but requires the Puffboy to always send at least a single integrity bit with every message. Each iteration of the message passing has refactored how much metadata is submitted. With the latest change it now only sends a single bit. Before that I was preparing for a world where concurrent messages could be sent to the gameboy, I no longer think that makes much sense. Who knows.