Skip to content
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

Make scoring and reporting logic more performant #132

Closed
BioPhoton opened this issue Oct 19, 2023 · 1 comment · Fixed by #212
Closed

Make scoring and reporting logic more performant #132

BioPhoton opened this issue Oct 19, 2023 · 1 comment · Fixed by #212
Assignees
Labels
💡 good first issue good for newcomers 🔥 performance performance optimization 🧩 utils

Comments

@BioPhoton
Copy link
Collaborator

BioPhoton commented Oct 19, 2023

The current scoring and reporting logic is not written in a performance way.

  • The logic for groups and plugins is different from groups and audits. If we unify the data structures it would simplify the code
    • We can score groups at the beginning
    • We can add the plugin to slug to audits and groups to avoid a nested loop
  • For scoring the categories could introduce a dict with keys like ${plugin}${type}${slug} to reduce the iterations
  • In categoryRefToScore and groupRefToScore we use find to get the score or a specific audit or group. This is done for each ref in a category. If we intro a dictionaries for plugins we can avoid it.
    To improve the performance I suggest to do the following things:
  • We should introduce a function that scores a report one time so ti can be reused for the different report formats

Update:

After the recent changes we decided to remove the plugin in audits in ScoredReport and go with a dic of audits under plugins where key a combination of type, plugin, audit/group.

related to #137 and #133

@BioPhoton
Copy link
Collaborator Author

Moved this here from #178 :

💡 🧩 utils: TODO intro dict to avoid multiple find calls in the scoreFn

MishaSeredenkoPushBased added a commit that referenced this issue Nov 14, 2023
Improved the performance of scoring and reporting.
Removed nested loops where possible, added dictionaries to go constant
time O(1) instead of linear O(n).
Made minor refactoring, added some checks.
@BioPhoton As task owner, let me know if I understood the task correctly
and implemented everything properly. Also, maybe you could propose
additional changes for further performance improvements.

Closes #132
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 good first issue good for newcomers 🔥 performance performance optimization 🧩 utils
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants