Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cgen: fix performance regression with
x in {...}
(#807)
## Summary Fix a regression in the C code generator that led to slightly less efficient code being generated for `x in set` where set is a constant set construction expression. ## Details The decision of whether to emit set construction code or to use an `||` (or) chain of comparisons was still based on the presence of the `nfAllConst` flag, but node flags don't reach the code generators ever since the introduction of the MIR and `astgen`, meaning that the `||` chain was always chosen for set literals with less than 8 elements. Testing for the flag is replaced with a call to `isDeepConstExpr`, restoring the originally intended behaviour (i.e., emit set construction code for sets with a size-in-bytes <= `sizeof(int)`). In addition, the other remaining usage of `nfAllConst` in `ccgexprs.genSetConstr` is removed completely: fully constant construction expressions are already handled by its single callsite (`ccgexprs.expr`).
- Loading branch information