Skip to content

Improve performance of find_max_char #122901

@ruema

Description

@ruema

Feature or enhancement

Proposal:

find_max_char is called each time a string is created.
By reducing the amount of tests, the performance can be improved considerably.

python -m pyperf timeit -s "b=('a' *1000+ '\u019f'*2)" "b[:-1]"
+-----------+--------+----------------------+
| Benchmark | ref    | patch                |
+===========+========+======================+
| timeit    | 442 ns | 388 ns: 1.14x faster |
+-----------+--------+----------------------+

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance 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