Help Choosing Upgrade from ATMEGA328 on UNO for Production Version of PCB

Maybe there is a way to optimize your code instead of buying a more expensive micro-controller would it be possible to post your code? A hint is avoid using the arduino libraries they are usually bloated and inefficient anyways and can be replaced with better code. That saves a lot of space.