Skip to content

POC: Provide Set<ShapeId> to onRemove #2557

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kubukoz
Copy link
Contributor

@kubukoz kubukoz commented Mar 10, 2025

Background

#2556 - trying to filter shapes more effectively.

Testing

  • How did you test these changes?

Links

  • Links to additional context, if necessary
  • Issue #, if applicable (see here for a list of keywords to use for linking issues)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -44,10 +47,12 @@ Model transform(ModelTransformer transformer, Model model) {
removed.addAll(removedShape.members());
}

Set<ShapeId> removedIds = removed.stream().map(Shape::getId).collect(Collectors.toSet());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

thought: This traversal itself has some overhead, we can make it lazy if needed, but I'd wager it's going to be beneficial as more plugins are migrated to use this variable.

The whole thing definitely needs some benchmarks, I can get some profiling going on my own build another time.

@@ -27,4 +30,8 @@ public interface ModelTransformerPlugin {
default Model onRemove(ModelTransformer transformer, Collection<Shape> removed, Model model) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

thought: left for binary compatibility

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.

1 participant