[Chapel Merge] Two little string optimizations

Branch: refs/heads/main
Revision: 17cb1aa
Author: mppf
Log Message:

Merge pull request #18323 from mppf/optimize-string-stuff

Two little string optimizations

This PR has two little string optimizations I came up with while working
on #11158. This PR provides a modest speed improvement to
knucleotide-strings.chpl by avoiding some redundant work within the
string implementation.

Reviewed by @e-kayrakli - thanks!

  • [x] full local testing

Future Work:

  • create a bytes-based variant of knucleotide-strings.chpl as a
    performance benchmark

  • improve the string implementation for the patterns used in
    knucleotide-strings.chpl.

    • improve substring operations by having them return some sort of
      "view" into the existing string. See #11222 (and to some degree
      #12670).
    • improve operations on short strings with a short-string
      optimization. See #11221.

    Modified Files:
    M modules/internal/BytesStringCommon.chpl
    M modules/internal/String.chpl

    Compare: https://github.com/chapel-lang/chapel/compare/4e97e1e8f253...17cb1aafc554