-
Notifications
You must be signed in to change notification settings - Fork 827
TypeID and is* functions in Lua #2291
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
base: master
Are you sure you want to change the base?
Conversation
|
You can make the is* functions a fair bit faster by doing something similar to this. Whether it's really worth it 🤷 |
I think you missed that we already getting the default type function which is the fastest you can get lol (it's already there for server/menu states on x64) I will apply a micro-optimization to make it use the Ctype function for builtin types |
|
Your Lua implementation of |
|
Nice catch, will push a fix, also forgot that IsEntity exists too lul |
|
I think |
Your right indeed, although I don't think the performance difference will matter that much but no reason to deny it 🥸 |
So why not do this to get at least a little extra speed |
I thought I updated it, thanks for reminding me lol |
|
bump |




This now should fully close Facepunch/garrysmod-issues#4100
The only difference in behaviour is that old one (probably) doesn't use the MetaID of a userdata if it's not a gmod type? Not sure really.
Both new functions need to be placed after the new type function to work correctly.
I forgot to localize
getmetatablefortypefunction, wanted to see if it's going to make a difference, and saw around 10~15% increase in performance when benchmarking my serializing library. (basically placelocal getmetatable = getmetatablebefore this andtypefunction)