Menu

#447 INSPECT performance when only a single TALLYING/REPLACING is used

unclassified
accepted
nobody
4
2024-01-17
2023-09-28
No

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).

Discussion

  • Simon Sobisch

    Simon Sobisch - 2023-11-16

    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 like LOW-VALUE BY SPACE.

     
  • Simon Sobisch

    Simon Sobisch - 2024-01-17

    Partial tackled that with [r5189], more to come when pulling in the November changes...

     

    Related

    Commit: [r5189]


Log in to post a comment.