Skip to content
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

Constant array boundary lookups in lua_ref #1224

Open
Mooshua opened this issue Apr 5, 2024 · 0 comments
Open

Constant array boundary lookups in lua_ref #1224

Mooshua opened this issue Apr 5, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Mooshua
Copy link

Mooshua commented Apr 5, 2024

Hi,

I'm seeing some semi-expensive luaH_getn invocations on the registry a la lua_ref. It seems like aboundary is being used by the hashtable, causing the VM to continuously find the array boundary again. Stepping through it in a debugger, it looks like t->aboundary/t->lastfree is always 1.

This has little impact except where lua_ref is in a hot path. Unfortunately, this means a lot of binding layers are impacted.

VTune Call Tree in a simple benchmark program:

Callers	                        Effective Time	Spin Time	Overhead Time	Effective Time	Spin Time	Overhead Time	Wait Time: Total	Wait Time: Self
[Loop at line 781 in luaH_getn]	100.0%	0.0%	0.0%	637619.390usec	0usec	0usec		
  luaH_getn	                100.0%	0.0%	0.0%	637619.390usec	0usec	0usec		
    lua_ref	                100.0%	0.0%	0.0%	637619.390usec	0usec	0usec		
@Mooshua Mooshua added the enhancement New feature or request label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant