perf(client): reduce unnecessary frame polling in weapon loops#219
Open
Lens931 wants to merge 2 commits into
Open
perf(client): reduce unnecessary frame polling in weapon loops#219Lens931 wants to merge 2 commits into
Lens931 wants to merge 2 commits into
Conversation
Refactor weapon handling to improve event-based tracking and remove unnecessary loops. Update conditions for setting current weapon and handling broken weapons.
perf(client): optimize weapon draw loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR reduces unnecessary client-side frame polling in
qb-weapons.The current client logic contains multiple
while trueloops usingWait(0). Some of these checks only need to run every frame during active weapon states, such as firing, drawing, holstering, or interacting with weapon repair points.This patch keeps weapon behavior responsive while reducing idle client CPU usage.
Problem
On FiveM,
Wait(0)runs every frame. With multiple always-running client loops, this can create unnecessary resource usage even when the player is idle, unarmed, or not interacting with weapons.This is not described as a memory leak. It is more accurately a client-side performance issue caused by legacy per-frame polling.
Changes
Wait(0)usage in client weapon loops.Expected result
Test checklist
Tested or should be tested: