qb-core
qb-core copied to clipboard
Cache common Identifiers for faster access
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.
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
This PR has had 60 days of inactivity & will close within 7 days