Python code performance in Kubernetes pods

is there a way how to improve Python performance in Kubernetes (containerd)? We make some tests using the same code and it looks like in the container it executes twice slower than on bare metal.

I find a tag seccomp=unconfined (Seccomp security profiles for Docker | Docker Documentation) but don’t know if it is secure to use it on production environment.

Is there anything else to fix that?

Cloud being used: GKE on GCP