Slow C++ application

I have installed nix shell on my Debian machine (wsl2), and I have a C++ project that builds an executable.

The project has a flake file ( flake.nix) with all required compile and runtime dependencies.

The project builds fine on my Debian machine and run as expected, but when I use the nix docker from nix community, my project builds fine ( at least no cmake/make errors) but it is at least 3 times slower In docker.

And I am quite unable to find the issue. I checked with ldd, and both executables have the same libs hashes but only the memory addresses are different.

I tried with also with pref and the results are very different, as if the slower version on docker is doing sth totally different.

I would really appreciate any help.

Your description of how you produced the two different images is too vague. Can you share the steps you took to produce these images? And what exactly do you mean with “nix docker from nix community”?