Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster *_find_max_char #59350

Closed
serhiy-storchaka opened this issue Jun 22, 2012 · 5 comments
Closed

Faster *_find_max_char #59350

serhiy-storchaka opened this issue Jun 22, 2012 · 5 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@serhiy-storchaka
Copy link
Member

BPO 15145
Nosy @pitrou, @vstinner, @serhiy-storchaka
Files
  • find_max_char_2.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-10-17.13:56:30.972>
    created_at = <Date 2012-06-22.20:51:57.901>
    labels = ['interpreter-core', 'performance']
    title = 'Faster *_find_max_char'
    updated_at = <Date 2012-10-17.13:57:54.273>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2012-10-17.13:57:54.273>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-10-17.13:56:30.972>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2012-06-22.20:51:57.901>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['27602']
    hgrepos = []
    issue_num = 15145
    keywords = ['patch']
    message_count = 5.0
    messages = ['163480', '163489', '163498', '173176', '173177']
    nosy_count = 3.0
    nosy_names = ['pitrou', 'vstinner', 'serhiy.storchaka']
    pr_nums = []
    priority = 'low'
    resolution = 'rejected'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue15145'
    versions = ['Python 3.4']

    @serhiy-storchaka
    Copy link
    Member Author

    Here is patch that speed up *_find_max_char stringlib functions.

    Microbenchmarks:

    ./python -m timeit -s "s='A'*20+'\x80'" "s[:-1]"
    ./python -m timeit -s "s='A'*20+'\U00010000'" "s[:-1]"

    Results on Intel Atom N570 @ 1.66GHz:

    vanilla patched

    0.819 0.73
    0.788 0.755

    @serhiy-storchaka serhiy-storchaka added interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage labels Jun 22, 2012
    @pitrou
    Copy link
    Member

    pitrou commented Jun 22, 2012

    0.819 0.73
    0.788 0.755

    Are there any circumstances where this produces a larger speedup?
    I don't think a 10% improvement on a micro-benchmark is interesting at all (it's basically 0% on any real-world program).

    @serhiy-storchaka
    Copy link
    Member Author

    Are there any circumstances where this produces a larger speedup?

    I don't know. *_find_max_char in any case only a part of expensive
    functions. Even if it is optimized to zero time, this will most likely
    not produce a larger speedup.

    I don't think a 10% improvement on a micro-benchmark is interesting at all (it's basically 0% on any real-world program).

    I agree. It is rather a question of purity. In my opinion the function
    has become easier (for developer and for compiler).

    @serhiy-storchaka
    Copy link
    Member Author

    Patch updated to tip.

    But because results are contradictory and often patched version even slower vanilla (and I don't understand why it happens), I close the issue. I think all changes are irrelevant and differences are only compiler optimization artifacts.

    @pitrou
    Copy link
    Member

    pitrou commented Oct 17, 2012

    Thanks for the effort, Serhiy!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants