You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The use of any of these functions [loadstring, getfenv, setfenv] performs a dynamic deoptimization, marking the affected environment as “impure”. The optimizations are only in effect on functions with “pure” environments - because of this, the use of loadstring/getfenv/setfenv is not recommended. Note that getfenv deoptimizes the environment even if it’s only used to read values from the environment.
Modules currently gets the requiring script's name using getfenv, as this paragraph describes. This disables Luau optimizations, as the requiring script's environment becomes "impure".
A suggestion made by @howmanysmall provides a good alternative: using debug.traceback to create the "require taking too long" warnings. The output format of debug.traceback is not defined, so parsing its output is a bad idea.
The text was updated successfully, but these errors were encountered:
https://roblox.github.io/luau/performance.html#importing-global-access-chains
Modules currently gets the requiring script's name using getfenv, as this paragraph describes. This disables Luau optimizations, as the requiring script's environment becomes "impure".
A suggestion made by @howmanysmall provides a good alternative: using
debug.traceback
to create the "require taking too long" warnings. The output format ofdebug.traceback
is not defined, so parsing its output is a bad idea.The text was updated successfully, but these errors were encountered: