INSPECT
is one of the "all usage hammers" of COBOL. To allow the full feature-set which includes multiple TALLYING/REPLACING where a part that is already counted/replaced should not be counted/replaced again we have the arrays inspect_mark
and inspect_repdata
in libcob/strings.h.
The performance issue is: we won't need that and can instead "directly tally" / "directly replace" if we have only one of the phrases TALLYING
or REPLACING
.
cobc can detect that and then do a different codegen; passing another "replacing" value to cob_inspect_init
and generating a new cob_inspect_characters_single
call instead of the previous cob_inspect_characters
. That will drop the initialization and check for the two arrays above (and all the related integers).
Short update:
For direct REPLACING I've did a local adjustment: it internally converts that to
INSPECT CONVERTING
which is performance-optimized in 3.2 already, and optimized that a bit more to improve performance for single character conversions likeLOW-VALUE BY SPACE
.Partial tackled that with [r5189], more to come when pulling in the November changes...
Related
Commit: [r5189]