Background tasks running slower than foreground

I am running an app I created on a samsung Note 20 Ultra. I managed to get the app to stay in the background by selecting “keep Open” and setting the battery restrictions to “unrestricted”… seems to work but runs much slower when in the background. I can tell by the amount of time it takes to process data intensive tasks as well as how fast it is logging. Is there any way to keep a samsung phone from slowing your application when it is in background?