Skip to content

Commit d7a1cae

Browse files
authored
Add note on possible future filtering optimization. (#699)
1 parent 51c331e commit d7a1cae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

trustfall_core/src/interpreter/filtering.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,12 @@ fn apply_filter_op<
391391
left: &FieldValue,
392392
right: &RightValue,
393393
) -> Option<DataContext<Vertex>> {
394+
// TODO: This is a missed optimization opportunity:
395+
// It's possible that computing the arguments for the filter function was expensive,
396+
// and we might have been able to skip it if `ctx.within_nonexistent_optional()` is true.
397+
// With the current impl, we fail to do so.
398+
// For example: we may have created a Regex value from a tag, or used a `@transform` on
399+
// a property to perform some computation on either the left or right value (#617).
394400
(ctx.within_nonexistent_optional() || filter_op(left, right)).then_some(ctx)
395401
}
396402

0 commit comments

Comments
 (0)