-
Notifications
You must be signed in to change notification settings - Fork 165
Improve performance skill req check caching #283
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
Improve performance skill req check caching #283
Conversation
…ill requirement checks to optimize performance. Add invalidation on relevant stat, item, and skill changes, and initialize cache on character login.
… initialization and improve guardian checks for clarity and performance.
… future maintainability
Summary of ChangesHello @Mosch0512, 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 a robust caching mechanism for skill requirement checks, dramatically enhancing game performance by eliminating repetitive computations. By intelligently storing and invalidating these checks based on character state changes, the system provides a smoother and more responsive user experience, especially in scenarios where skill evaluations are frequent. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a caching mechanism for skill requirement checks, which is a great performance improvement. The implementation is mostly correct, with cache invalidation points well-placed. I've found a few issues, including a potential critical bug in the cache rebuilding logic and some opportunities for code cleanup to improve maintainability. Please see my detailed comments.
| // Character stats changed, invalidate skill requirements cache | ||
| // it is called in `CalculatedAll` already, but for future changes and understandability also kept here because it does not have a huge impact. | ||
| gSkillManager.InvalidateSkillRequirementsCache(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment acknowledges that InvalidateSkillRequirementsCache() is already called within CharacterMachine->CalculateAll(). To avoid redundancy and improve code clarity, this duplicate call should be removed. Relying on CalculateAll() to handle the cache invalidation centralizes the logic and makes the code easier to maintain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you say @sven-n
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's okay
…he resulting baseSkill should be used
|
Nice improvement :) Thank you! |
Tested in Devias 3 i had about 8+% fps increase.
There is definitely other checks that could get a similar update later
This pull request significantly enhances performance by implementing a caching layer for skill requirement checks. Instead of recalculating skill prerequisites every time, the system now stores these results and intelligently invalidates the cache only when underlying character attributes, skills, or equipment change. This approach minimizes computational overhead, leading to a smoother and more responsive user experience, especially in scenarios where skill checks are frequent.
Highlights
AreSkillRequirementsFulfilledto optimize performance by avoiding redundant calculations of skill requirements.RebuildSkillRequirementsCachemethod, which populates the cache for all skills.