@Seven71ne
It can be pretty daunting, but mitu explained very well the configuration autosaving schema for retroarch.
For retroarch cores, I will usually create configurations by-core. and these are mainly preferences, and not a lot that I do for optimization. These being like how i want to map a sega 6 button controller to my gamepad, or if there is some feature i like to use on this core.
Then there are certain games which may require something specific to be configured, or optimization as needed. And so I will create a configuration for that specific game. I've probably spent the most time configuring PSX games like this, some games not supporting dualshock/analog need to be configured to use digital pad, or vise-versa if you want to use analog on supporting games and digital is the default.
Depending what to consider optimization, there is a lot to take on, sometimes ive been driven to the point to learn a little bit of shell script to streamline an arduous task done by hand. I think mainly if you get stuck on something don't be afraid to ask in the appropriate channels. I got a lot of support and answers from searching all over the web about specific things that only one person was ever asking.
as a side note, if you are looking for performance optimisations something to avoid is changing the video display resolution options in run-command. This typically, but espescially for retroarch cores will not change rendering resolution and thus offers no performance gain.