-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Micro optimizations to player.GetBy*
functions
#2124
base: master
Are you sure you want to change the base?
Conversation
speed up player.getby____ID(ID) functions by relying primarily on indexing a table
some fine tuning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this even necessary? I can't imagine these functions being used in such contexts where they'd cause serious performance issues, for the trade off of uglifying the code and introducing potential reliability issues.
Have you even tested these changes? I am seeing multiple issues just by skimming over the changes.
Not to mention the PR does not adhere to the contributing guidelines.
player.GetBy*
functions
I have also just noticed that this is effectively duplicate of #2094, but with also affecting the other functions. |
here's the code i used to test my changes for i=1,128 do
local p=Entity(i)
if!p:IsValid()then continue end
if!p:IsPlayer()then break end
MsgN"_____________________________________________\n"
MsgN(p)
local ID=p:AccountID()
MsgN("player.GetByAccountID(",ID,")=",player.GetByAccountID(ID))
local ID=p:SteamID()
MsgN("player.GetBySteamID\"",ID,"\"=",player.GetBySteamID(ID))
local ID=p:SteamID64()
MsgN("player.GetBySteamID64\"",ID,"\"=",player.GetBySteamID64(ID))
local ID=p:UniqueID()
MsgN("player.GetByUniqueID\"",ID,"\"=",player.GetByUniqueID(ID))
end
MsgN"_____________________________________________\n" |
fix the formating so that it matches contributing.md
speed up player.GetBy____ID(ID) functions by relying primarily on indexing a table