Skip to content

perf: recording performance optimizations#83

Merged
fank merged 7 commits intomainfrom
worktree-keen-elm-lips
Feb 28, 2026
Merged

perf: recording performance optimizations#83
fank merged 7 commits intomainfrom
worktree-keen-elm-lips

Conversation

@fank
Copy link
Member

@fank fank commented Feb 23, 2026

Summary

  • Cache vehicle/marker exclusion lists at init instead of parsing per entity/event
  • Fix broken unitData state deduplication (wrong variable name + frame number in comparison) — highest impact change, eliminates redundant extension calls for dead/stationary units
  • Cache player scores and unit type recalculation to skip redundant work when values haven't changed
  • Replace count anti-pattern with findIf for early-exit in APC classification
  • Replace chained select with single-pass counting in telemetry loop

Test Plan

  • hemtt build passes on every commit (44 SQF files compiled, 3 PBOs built)
  • Verify recording playback produces correct data in a live mission
  • Confirm dead/stationary units no longer send redundant :SOLDIER:STATE: calls

fank added 6 commits February 23, 2026 23:47
…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).
@gemini-code-assist
Copy link

Summary of Changes

Hello @fank, 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 introduces several performance optimizations to the recording system. By caching frequently accessed exclusion lists, fixing a critical unit data deduplication bug, and optimizing data collection loops, the changes aim to reduce CPU overhead and network traffic, particularly for dead or stationary units, leading to a more efficient and responsive recording process.

Highlights

  • Exclusion List Caching: Vehicle and marker exclusion lists are now cached during initialization to prevent repeated parsing, improving performance.
  • Unit Data Deduplication Fix: A critical bug in unit data state deduplication was corrected, significantly reducing redundant extension calls for inactive units.
  • Player Scores & Unit Type Caching: Implemented caching for player scores and unit type recalculations to avoid unnecessary work when these values remain unchanged.
  • Optimized APC Classification: An inefficient count anti-pattern was replaced with findIf for early-exit logic in APC classification, enhancing efficiency.
  • Telemetry Loop Refactoring: Streamlined telemetry data collection by replacing chained select operations with single-pass counting loops, reducing processing overhead.
Changelog
  • addons/recorder/fnc_captureLoop.sqf
    • Introduced caching for unit weapons and player scores to reduce redundant calculations.
    • Fixed a bug in unit data deduplication by correcting the variable name and adjusting the frame number comparison logic.
    • Replaced dynamic parsing of exclusion lists with pre-cached global variables.
  • addons/recorder/fnc_handleMarkers.sqf
    • Modified marker handling to use a globally cached exclusion list instead of parsing it repeatedly.
  • addons/recorder/fnc_init.sqf
    • Added initialization for global variables excludeKindList, excludeClassList, and excludeMarkerList to cache exclusion settings.
  • addons/recorder/fnc_isKindOfApc.sqf
    • Refactored the APC classification logic to use findIf for improved performance.
  • addons/recorder/fnc_telemetryLoop.sqf
    • Optimized telemetry data collection by consolidating multiple select and count calls into single-pass iteration and direct counting.
Activity
  • The hemtt build process has successfully passed on all commits.
  • Verification of recording playback and confirmation of reduced redundant :SOLDIER:STATE: calls for dead/stationary units are pending.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces several performance optimizations by caching frequently accessed data and refactoring loops for efficiency. Key changes include caching vehicle/marker exclusion lists, fixing unit data deduplication, caching player scores and unit types, and optimizing array iterations. These changes align with the goal of reducing redundant computations and improving overall recording performance.

@fank fank force-pushed the worktree-keen-elm-lips branch from 91b2a86 to 45afb34 Compare February 28, 2026 15:37
@fank fank merged commit 88eabe7 into main Feb 28, 2026
1 check passed
@fank fank deleted the worktree-keen-elm-lips branch February 28, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant