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

Cache Nametags onDraw3D flags. #4847

Merged
merged 5 commits into from
Feb 10, 2017
Merged

Conversation

dedmen
Copy link
Contributor

@dedmen dedmen commented Jan 21, 2017

This will cache the Nametag Flags and _maxDistance for 2 seconds instead of reparsing them every Frame.
This will take about 0.0621ms of load from eachFrame and cache it.
After caching the load will be about 0.0323ms per frame.
0.03ms improvement call me crazy if you want.
This will also remove the unused privates from fnc_onDraw3d.

This will create lag from changing Nametag settings to them being visible. Sadly cachedCall can only use 1 Event and I used cba_events_visionModeEvent to be also able to cache the _maxDistance variable.
Calculating the _maxDistance variable takes 0.0267 ms so it's very worthwhile to be cached.

@jonpas jonpas added the kind/optimization Release Notes: **IMPROVED:** label Jan 21, 2017
@jonpas jonpas added this to the 3.9.0 milestone Jan 21, 2017
@dedmen dedmen mentioned this pull request Jan 21, 2017
@@ -0,0 +1,64 @@
/*
* Author: <N/A>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

who's that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@commy2
Copy link
Contributor

commy2 commented Jan 23, 2017

cba_events_visionModeEvent
That is only meant as an internal, but I can see how it really helps here. I don't mind, but technically it's not API and could potentially be nuked at some point either by accident, or by me being dumb and forgetting about this.

@dedmen
Copy link
Contributor Author

dedmen commented Jan 23, 2017 via email

@commy2
Copy link
Contributor

commy2 commented Jan 23, 2017

Can't avoid people using internals, but I can shift the blame on them if something breaks in good conscience. Doesn't help the end user, but I can sleep well at night.

@PabstMirror PabstMirror changed the base branch from master to medical-rewrite-effects February 4, 2017 03:58
@PabstMirror PabstMirror changed the base branch from medical-rewrite-effects to master February 4, 2017 03:58
@PabstMirror
Copy link
Contributor

@dedmen - looks good, I pushed some minor changes:

  • Can't cache the keybind alpha as it's designed to fade over time
  • Added manual cache reseting for both vision mode and ace_setting changes
  • Fixed cursorOnly mode with soundWaves to 2 - this was present in master, not related to this PR.

@PabstMirror PabstMirror modified the milestones: 3.9.1, 3.9.0 Feb 10, 2017
@PabstMirror PabstMirror merged commit 5351b43 into acemod:master Feb 10, 2017
thojkooi pushed a commit that referenced this pull request Mar 13, 2017
* Cache Nametag flags

* Remove unused privates

* Fix fading, cursorOnly mode, improve cache reset

* Fix header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/optimization Release Notes: **IMPROVED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants