I once did actually have to inline everything. Was making an EEPROM programmer using an arduino and two shift registers, and I wanted to make it go as fast as possible. I was sending data to it in packets over high speed serial, with an acknowledgement, and it had an internal buffer that could just barely not fill up (the EEPROM writing was slightly slower than the serial connection) as data was being consumed while processing a partial packet. It was so tightly constrained that if I didn't inline everything, the overhead of function calls was enough for the EEPROM writing to become just slow enough for the serial buffer to overflow, which meant I had to use a smaller buffer, which meant more idle time on the serial port, waiting for acknowledgements. Made the program huge, but in this case it did allow me to squeeze out every little bit of performance out of that tiny micro. I even had to patch out the timer interrupt code from the arduino core, as those interrupts were causing me to miss out on serial data.
vrighter•1d ago