Are you using the Ubuntu Snap to train Firefox? If so, you can switch to the native Debian packages released directly by Mozilla. They don't do that sandboxing stuff, and they are a lot faster. I don't notice any speed difference between Chromium und Firefox even on a Raspberry Pi.