Skip to content

Reduce calculation overhead in people contract and filter lookups - #89

Merged
Ayomi-gh merged 1 commit into
mainfrom
ayomi-gh/calculate-perf
Nov 6, 2026
Merged

Ayomi-gh merged 1 commit into
mainfrom
ayomi-gh/calculate-perf

Conversation

@Ayomi-gh

@Ayomi-gh Ayomi-gh commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Two small performance changes to group calculation, plus a version bump to 1.2.10.

  • People::YAML#read: the return contract checked every entry of the people hash on each call. The method builds and caches this hash itself, so the contract now checks only that a Hash is returned.
  • Filters::Base#member_of_named_group?: cache the group's members as a Set instead of an Array, so membership checks no longer scan the whole list.

In local profiling, calculation time roughly halved, and the resulting group membership was unchanged.

Tests: bundle exec rspec spec/unit passes (568 examples, 0 failures, 100% coverage).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI adaptive review requested due to automatic review settings November 6, 2026 14:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are identified for the performance, return-contract, and version updates described.

No open issues 🎉

What changed in this PR

This pull request reduces calculation and group-membership lookup overhead while updating the application version to 1.2.10.

Changes:

  • Simplifies the People::YAML#read return contract.
  • Caches calculated group member IDs in a Set for faster membership checks.
  • Updates the application version in the source and lockfile.
File Description
lib/​version.rb Updates the application version to 1.2.10.
lib/​entitlements/​data/​people/​yaml.rb Simplifies the full-read return contract.
lib/​entitlements/​data/​groups/​calculated/​filters/​base.rb Uses a Set for cached group membership lookups.
Gemfile.lock Synchronizes the locked application version.

Review effort: Lite (auto)

@Ayomi-gh
Ayomi-gh merged commit 72029ce into main Nov 6, 2026
21 checks passed
@Ayomi-gh
Ayomi-gh deleted the ayomi-gh/calculate-perf branch November 6, 2026 14:51
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.

3 participants