Luau optimisations are present in pure environments, however use of getfenv and setfenv mark an environment as impure and disable optimisations. More information can be found via Luau Lang - Performance.
As Roblox continues to develop Luau, it is important that novice developers do not adopt old and bad habits into new work. There are little to no circumstances where using these functions in production is necessary. New developers should be discouraged from using them and so a warning that using these two functions may result in degraded performance seems appropriate.
Why is getfenv/setfenv disabling performance stuff? There is litterary no replacement and I dont want to redo all my work. there is a debug stuff similar to getfenv however it is buggy and doesnt really do its job
This optimization relies on being able to predict the shape of the environment table for a given function; this is possible due to global sandboxing, however this optimization is invalid in some cases:
loadstring can load additional code that runs in context of the caller’s environment
getfenv / setfenv can directly modify the environment of any function
This is from the article colbert posted. As you can see, in laymans terms, it ‘disables performance stuff’ because some optimizations rely on a predictable environment, of which getfenv and setfenv allow direct modification to.
Marking this documentation request as solved in favour of the Luau RFC on deprecating fenv (this was brought to my attention via the latest model safety announcement). A deprecation would be a stronger and better indicator that it shouldn’t be pursued in new work: