Skip to content

Conversation

@Srlion
Copy link
Contributor

@Srlion Srlion commented May 16, 2025

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 getmetatable for type function, 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 place local getmetatable = getmetatable before this and type function)

@aStonePenguin
Copy link
Contributor

You can make the is* functions a fair bit faster by doing something similar to this.

Whether it's really worth it 🤷

@Srlion
Copy link
Contributor Author

Srlion commented May 16, 2025

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)
#2201

I will apply a micro-optimization to make it use the Ctype function for builtin types

@Zaurzo
Copy link
Contributor

Zaurzo commented May 17, 2025

Your Lua implementation of isentity will not work for all entities. Subclasses like Weapon and Vehicle have their own metatable and MetaName, so type will return Weapon or Vehicle for them

@Srlion
Copy link
Contributor Author

Srlion commented May 17, 2025

Nice catch, will push a fix, also forgot that IsEntity exists too lul

@Astralcircle
Copy link
Contributor

Astralcircle commented May 21, 2025

I think function isbool( v ) return v == true or v == false end will be even faster

@robotboy655 robotboy655 added the Enhancement The pull request enhances current functionality. label May 23, 2025
@Srlion
Copy link
Contributor Author

Srlion commented May 24, 2025

I think function isbool( v ) return v == true or v == false end will be even faster

Your right indeed, although I don't think the performance difference will matter that much but no reason to deny it 🥸

@Astralcircle
Copy link
Contributor

I think function isbool( v ) return v == true or v == false end will be even faster

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

@Srlion
Copy link
Contributor Author

Srlion commented May 25, 2025

I think function isbool( v ) return v == true or v == false end will be even faster

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

@robotboy655
Copy link
Collaborator

After testing this for 1 minute - it causes regression in the killfeed:
image

Probably elsewhere too.

@Srlion
Copy link
Contributor Author

Srlion commented Jul 15, 2025

After testing this for 1 minute - it causes regression in the killfeed: image

Probably elsewhere too.

It's because you forgot to push the builtin type function clientside, told you about it on discord but just to make sure you don't forget about it:
image

@Grocel
Copy link
Contributor

Grocel commented Jul 16, 2025

Discord_2025-07-16_13-03-25

:(

@bloodycop6385
Copy link

bump

@robotboy655 robotboy655 added the Requires engine changes The pull request requires changes to the internal source code and cannot yet be merged. label Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement The pull request enhances current functionality. Requires engine changes The pull request requires changes to the internal source code and cannot yet be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Beta Gmod bad jit performance

7 participants