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

Merge similar enhancement rules #51781

Open
Swatinem opened this issue Jun 28, 2023 · 0 comments
Open

Merge similar enhancement rules #51781

Swatinem opened this issue Jun 28, 2023 · 0 comments

Comments

@Swatinem
Copy link
Member

This is spawned out of #51354.

The main loop of enhancement rules looks like this:

for rule in self._modifier_rules:
for idx, action in rule.get_matching_frame_actions(
match_frames, platform, exception_data, cache
):
action.apply_modifications_to_frame(frames, match_frames, idx, rule=rule)

It iterates over each rule, and then over each action for a matching rule.
This can be suboptimal for multiple consecutive rules with similar matchers and the same actions, for example:

family:native function:_CxxThrowException                         ^-group -group ^-app -app
family:native function:__cxa_throw                                ^-group -group ^-app -app

In this case, we would execute both matchers, and up to 4 of the rules if a matcher is indeed matching.

There are two possibilities to optimize this:

Merge consecutive matchers with the same actions

In the example above, the two enhancers can be merged into one, matching a function name of either _CxxThrowException or __cxa_throw.

Merge directional actions

Right now, ^-group -group is treated as two separate actions, upwards (less), and equal. It should be possible to merge these into a single action "less or equal".

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

No branches or pull requests

1 participant