Skip to content

Cache common Identifiers for faster access #1183

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JericoFX
Copy link
Contributor

@JericoFX JericoFX commented Feb 27, 2025

Description

Cache the most common Identifiers so can be access more faster without for loops

Checklist

  • I have personally loaded this code into an updated qbcore project and checked all of its functionality.
  • [X ] My code fits the style guidelines.
  • [X ] My PR fits the contribution guidelines.

No need to manually deleted if i already have the function
@Qwerty1Verified
Copy link
Member

Hmm, so I benchmarked these and it only seemed marginally faster in some areas, and sometimes the benchmark would come out as slower. Could you possibly provide some benchmarks on your end? I also wonder whether it'd be quicker under load, since I only tested this in a dev server.

Before:

(Citizen ID) AVG Benchmark Results: 0.25904   ms      for     50      iterations

(License) AVG Benchmark Results: 0.29025   ms      for     50      iterations

(Phone) AVG Benchmark Results: 0.26174   ms      for     50      iterations

(Account) AVG Benchmark Results: 0.30763   ms      for     50      iterations

After:

(Citizen ID) AVG Benchmark Results: 0.21844   ms      for     50      iterations

(License) AVG Benchmark Results: 0.32354   ms      for     50      iterations

(Phone) AVG Benchmark Results: 0.21656   ms      for     50      iterations

(Account) AVG Benchmark Results: 0.28152   ms      for     50      iterations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants