Skip to content

Commit b331bbf

Browse files
committed
ReducedOpInfo: cache modified hints
Hints are immutable so instead of creating a new set each time they're requested, let's cache them once.
1 parent 92cbe04 commit b331bbf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scijava/scijava-ops-engine/src/main/java/org/scijava/ops/engine/reduce/ReducedOpInfo.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ public class ReducedOpInfo implements OpInfo {
2727
private final Type reducedOpType;
2828
private final int paramsReduced;
2929

30+
private final Hints hints;
3031
private final Struct struct;
3132
private ValidityException validityException;
3233

3334
public ReducedOpInfo(OpInfo src, Type reducedOpType, int paramsReduced) {
3435
this.srcInfo = src;
3536
this.reducedOpType = reducedOpType;
3637
this.paramsReduced = paramsReduced;
38+
this.hints = srcInfo.declaredHints().plus(BaseOpHints.Reduction.FORBIDDEN);
3739
List<ValidityProblem> problems = new ArrayList<>();
3840

3941
RetypingRequest r = retypingRequest();
@@ -126,7 +128,7 @@ public Struct struct() {
126128
}
127129

128130
@Override public Hints declaredHints() {
129-
return srcInfo().declaredHints().plus(BaseOpHints.Reduction.FORBIDDEN);
131+
return hints;
130132
}
131133

132134
@Override

0 commit comments

Comments
 (0)