Skip to content

Micro-optimize normalize_stacktraces_for_grouping #51354

@Swatinem

Description

@Swatinem

The function is slow, presumably because apply_modifications_to_frame of grouping enhancers is slow.
Here are a couple of ideas of how to optimize that.

Consider the following example enhancement rule:

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

This rule has 4 actions.

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)

As the rule itself is a modifier_rule, all of its 4 actions are being applied:

for action in self.actions:
rv.append((idx, action))

Even though the group action does not do anything in this specific case:

# Grouping is not stored on the frame
if self.key == "group":
return

Idea: Further split rules/actions when the modifier/updater split happens to useless actions are not called.

Then again, ^-group -group is two separate rules that are applied separately.

Idea: Maybe we can merge these two rules into one? We would then have a rule with an inclusive range, instead of two rules with an exclusive range and an exact index.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions