Why is the nix-compiled Python slower?

There seems to be an interesting history of the tension between enabling python optimizations and providing reproducibility.

https://github.com/NixOS/nixpkgs/pull/84072

https://github.com/NixOS/nixpkgs/pull/107965

As someone unfamiliar, I’m curious why enabling optimizations make the builds nondeterministic. Is this true generally, or just for python? Does the optimizer inject randomness directly? Does it use a Monte Carlo simulation for optimization or something similar, and could it accept a pre-selected seed for a PRNG instead?

9 Likes