Speed up CV_Findvar & CV_FindNetVar with hashtable #225

Merged
alufolie91 merged 3 commits from optifindvar into Saturn-Next 2026-04-04 17:05:25 +02:00
alufolie91 commented 2026-04-04 16:55:49 +02:00 (Migrated from github.com)

Gives a small increase of 4-5fps on my usual timedemo and maybe slightly speeds up server joins, but couldnt confirm the latter
Ideally lua scripts should always cache cvars in local variables to avoid calling cv_findvar at runtime at all (not only does the actual lookup cost time but so does having to invoke the whole lua api and related things)
this atleast speeds up the lookup part quite a bit
to make things a little easier since the table needs to be initiialized as early as possible, this also introduces the GNU "constructor" and "destructor" attributes
For how they work look at the comment in doomdef.h
this shouldnt cause any issues hopefully, but should still be tested a little in any case

Gives a small increase of 4-5fps on my usual timedemo and maybe slightly speeds up server joins, but couldnt confirm the latter Ideally lua scripts should always cache cvars in local variables to avoid calling cv_findvar at runtime at all (not only does the actual lookup cost time but so does having to invoke the whole lua api and related things) this atleast speeds up the lookup part quite a bit to make things a little easier since the table needs to be initiialized as early as possible, this also introduces the GNU "constructor" and "destructor" attributes For how they work look at the comment in doomdef.h this shouldnt cause any issues hopefully, but should still be tested a little in any case
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: saturn/SRB2Kart-Saturn#225