Menu

#511 compile-time optimization: EVALUATE single-var TO switch

unclassified
accepted
nobody
5 - default
2026-02-03
2026-02-03
No

There are at least 3 reasonable optimizations:

1: translate EVALUATE pic-x1-item WHEN 'a'... to switch (pic-x1-data) {case 'a'}
2: internally do that for EVALUATE TRUE when all elements are 88-condition-names for the same variable

this would be a minor performance update, mostly generating "nicer code" than the current one

3: optional: do something similar for pic-xN-items (possibly with N <=3/9/???) using a switch for each position - but that would need a go to label to reach the WHEN OTHER/end position within the inner default case - but then... we likely have at least the end label for the current generation of if (memcmp(...)) already

This would be a bigger optimization for commonly executed comparisons of "status" and "type" fields which may be longer.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB