Skip to content

refactor: continued work to improve config handling and tests#1500

Merged
anderseknert merged 1 commit intomainfrom
config-cleanup
Apr 24, 2025
Merged

refactor: continued work to improve config handling and tests#1500
anderseknert merged 1 commit intomainfrom
config-cleanup

Conversation

@anderseknert
Copy link
Member

  • Check if files are ignored globally only once, and before proceeding to check if they are ignored by some specific rule's configuration
  • Stop using config.for_rule("category", "title") now that we can refer directly to config.rules.category.title
  • Stop using data.internal in tests

Obviously, there's gotta be some performance improvements in there somewhere too :P Luckily having the global ignore check done only once per file gave us that!

1070530708 ns/op	3041023912 B/op	58063258 allocs/op
1048394166 ns/op	2953960968 B/op	56616841 allocs/op

Now getting awfully close to sub-second times :)

- Check if files are ignored globally only once, and before proceeding
  to check if they are ignored by some specific rule's configuration
- Stop using config.for_rule("category", "title") now that we can refer
  directly to config.rules.category.title
- Stop using data.internal in tests

Obviously, there's gotta be some performance improvements in there
somewhere too :P Luckily having the global ignore check done only
once per file gave us that!

```
1070530708 ns/op	3041023912 B/op	58063258 allocs/op
1048394166 ns/op	2953960968 B/op	56616841 allocs/op
```
Now getting awfully close to sub-second times :)

Signed-off-by: Anders Eknert <anders@styra.com>
Copy link
Contributor

@charlieegan3 charlieegan3 left a comment

Choose a reason for hiding this comment

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

Great work! 🤖

@anderseknert anderseknert merged commit fef38cf into main Apr 24, 2025
5 checks passed
@anderseknert anderseknert deleted the config-cleanup branch April 24, 2025 08:54
HookFirebolt pushed a commit to HookFirebolt/regal that referenced this pull request Apr 28, 2025
…olicy-agent#1500)

- Check if files are ignored globally only once, and before proceeding
  to check if they are ignored by some specific rule's configuration
- Stop using config.for_rule("category", "title") now that we can refer
  directly to config.rules.category.title
- Stop using data.internal in tests

Obviously, there's gotta be some performance improvements in there
somewhere too :P Luckily having the global ignore check done only
once per file gave us that!

```
1070530708 ns/op	3041023912 B/op	58063258 allocs/op
1048394166 ns/op	2953960968 B/op	56616841 allocs/op
```
Now getting awfully close to sub-second times :)

Signed-off-by: Anders Eknert <anders@styra.com>
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.

2 participants