Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Currently, EnumerableRelImplementor stashedParameters is a map with no deterministic order when its values are traversed.
Because of this, it is possible to have two EnumerableRel which are effectively equal, but which generate a different dynamic code, just because the statements in which stashedParameters are defined are the same, but in different order.
final Collection<Statement> stashed =
Collections2.transform(stashedParameters.values(),
input -> Expressions.declare(Modifier.FINAL, input,
Expressions.convert_(
Expressions.call(DataContext.ROOT,
BuiltInMethod.DATA_CONTEXT_GET.method,
Expressions.constant(input.name)),
input.type)));
This has a disadvantage: in this situation, EnumerableInterpretable's BINDABLE_CACHE will not have a cache hit, so the Bindable will need to be unnecessarily recreated in EnumerableInterpretable#getBindable.
If we guarantee a deterministic order in EnumerableRelImplementor stashedParameters (e.g. insertion order), we would have a cache hit in these situations (and we could skip the bindable re-creation).
Attachments
Issue Links
- links to