perf: recording performance optimizations — round 2#84
Conversation
…ame from comparison The state comparison at captureLoop:170 never worked due to two bugs: 1. Read from "unitData" but wrote to "OCAP_unitData" (QGVARMAIN mismatch) 2. Frame number at index 8 changed every frame, making comparison always unequal Fix uses a 0 placeholder for frame during comparison and stores a deep copy. This eliminates redundant extension calls for unchanged units (dead, stationary).
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on a second round of performance optimizations for the recording system. The changes aim to reduce CPU and extension overhead by caching frequently accessed data, deduplicating state transmissions for units and vehicles, and streamlining data collection loops. The overall impact is a more efficient and less resource-intensive recording process. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces several significant performance optimizations to the recording loop, primarily by caching frequently accessed data and reducing redundant computations. The changes include caching ACE function existence checks, vehicle and unit state deduplication to minimize extension calls, and optimizing lookups for vehicle turrets and entity exclusion lists. The refactoring in fnc_telemetryLoop.sqf to use forEach instead of multiple select calls is a particularly impactful improvement. My review found one minor opportunity to improve code readability in the new turret direction logic, but overall the changes are well-implemented and align with the stated goals of the pull request.
# Conflicts: # addons/recorder/fnc_captureLoop.sqf # addons/recorder/fnc_init.sqf
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces several excellent performance optimizations to the capture loop and supporting functions. Caching ACE function checks, vehicle state deduplication, and using native operators are all great improvements.
However, I've found a correctness issue in the optimization for telemetry global counts. The new logic undercounts entities by only considering the four main sides, which will lead to inaccurate telemetry. I've left a detailed comment with a suggestion to revert that specific part of the change to ensure data correctness.
Overall, great work on improving performance. Once the telemetry issue is addressed, this will be a solid contribution.
Summary
Follows PR #83. Further reduces CPU and extension overhead in the capture loop and supporting functions.
isNil "ace_..."string checks that ran per unit per frame are now cached once at init, since ACE presence can't change at runtime. Also cachesobjectParentto avoid duplicate calls.:VEHICLE:STATE:extension calls for unchanged vehicles (parked/static).hasTurretper vehicle at init usingweaponsTurret. SkipsCBA_fnc_turretDirfor unarmed vehicles, eliminating CBA warning log spam for civilian cars etc.{ ... false } countpurely for side effects — replaced with idiomaticforEach.typeOfeliminates redundant config lookups for vehicles of the same type.in: Drops scripted function overhead in handleMarkers and getUnitType — HEMTT linter confirmedinis faster thanfind.Test plan
hemtt buildpasses (verified locally, zero warnings)