Skip to content

Improve performance of startswith, endswith, count, *find, and *index methods for str, bytes and bytearray #117431

Open

Activity

  1. eendebakpt commented on Apr 2, 2024

    @eendebakpt
    Author
  2. added a commit that references this issue on Apr 3, 2024
  3. changed the title [-]Improve performance of startswith and endswith methods for str and bytes[/-] [+]Improve performance of startswith, endswith, count, *find, and *index methods for str, bytes and bytearray[/+] on Apr 3, 2024
  4. erlend-aasland commented on Apr 3, 2024

    @erlend-aasland
    Contributor

    Conversion of bytes/bytearray find() and friends1 is not straight-forward: the first argument can be either a buffer or an index in the range [0,255]. The code is shared between bytes and bytearray2. My first thought would be to create a custom Argument Clinic converter3, but we'd want that also to be shared between bytes and bytearray.

    Footnotes

    1. rfind, index, rindex, count ↩

    2. Objects/bytes_methods.c ↩

    3. a combination of one Argument Clinic Python input block and one C function ↩

  5. added 4 commits that reference this issue on Apr 3, 2024
  6. hugovk commented on Apr 3, 2024

    @hugovk
    Member

    Nice work so far! Would be good to put these in What's New, perhaps under https://docs.python.org/3.13/whatsnew/3.13.html#optimizations.

    Can be done later, when closing the issue.

  7. added 3 commits that reference this issue on Apr 6, 2024
  8. added 6 commits that reference this issue on Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13only security fixesperformancePerformance or resource usagetype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions