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

richcompare for strings #34507

Closed
loewis mannequin opened this issue May 15, 2001 · 6 comments
Closed

richcompare for strings #34507

loewis mannequin opened this issue May 15, 2001 · 6 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@loewis
Copy link
Mannequin

loewis mannequin commented May 15, 2001

BPO 424335
Nosy @tim-one, @loewis
Files
  • string.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 = 'https://github.com/loewis'
    closed_at = <Date 2001-06-02.10:15:47.000>
    created_at = <Date 2001-05-15.19:54:03.000>
    labels = ['interpreter-core']
    title = 'richcompare for strings'
    updated_at = <Date 2001-06-02.10:15:47.000>
    user = 'https://github.com/loewis'

    bugs.python.org fields:

    activity = <Date 2001-06-02.10:15:47.000>
    actor = 'loewis'
    assignee = 'loewis'
    closed = True
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2001-05-15.19:54:03.000>
    creator = 'loewis'
    dependencies = []
    files = ['3321']
    hgrepos = []
    issue_num = 424335
    keywords = ['patch']
    message_count = 6.0
    messages = ['36585', '36586', '36587', '36588', '36589', '36590']
    nosy_count = 2.0
    nosy_names = ['tim.peters', 'loewis']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue424335'
    versions = []

    @loewis
    Copy link
    Mannequin Author

    loewis mannequin commented May 15, 2001

    This patch implements the tp_richcompare slot for
    string objects. It shows a 8% speed-up on selected test
    cases.

    @loewis loewis mannequin closed this as completed May 15, 2001
    @loewis loewis mannequin self-assigned this May 15, 2001
    @loewis loewis mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label May 15, 2001
    @loewis loewis mannequin closed this as completed May 15, 2001
    @loewis loewis mannequin self-assigned this May 15, 2001
    @loewis loewis mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label May 15, 2001
    @loewis
    Copy link
    Mannequin Author

    loewis mannequin commented May 21, 2001

    Logged In: YES
    user_id=21627

    The new revision of the patch entirely removes tp_compare
    for string, following discussions on python-dev. The only
    direct user of string_compare has been changed to use the
    new function _PyString_Eq instead.

    @tim-one
    Copy link
    Member

    tim-one commented May 22, 2001

    Logged In: YES
    user_id=31435

    Assigned to me.

    @tim-one
    Copy link
    Member

    tim-one commented May 22, 2001

    Logged In: YES
    user_id=31435

    Marked accepted. Looks good!

    Suggest

    return a->ob_size == b->ob_size &&
    *a->ob_sval == *b->ob_sval &&
    memcmp(a->ob_sval, b->ob_sval, a->ob_size) == 0;

    for the tail of the _PyString_Eq body as compilers should
    have an easier time of turning that into the best code for
    the platform (especially the weaker compilers do better
    optimizing expressions than across branches). Plus it
    improves clarity, at least for me.

    Unsure why the

    case Py_EQ: c = c == 0; break; /* not needed here */

    case is there: if it's truly unreacable (and I agree it
    isn't), better to assert-fail if it gets there.

    @tim-one
    Copy link
    Member

    tim-one commented May 24, 2001

    Logged In: YES
    user_id=31435

    Oops! Looks like I forgot to assign this back to Martin.

    @loewis
    Copy link
    Mannequin Author

    loewis mannequin commented Jun 2, 2001

    Logged In: YES
    user_id=21627

    Committed as 2.117 of stringobject.c, 2.95 of
    dictobject.c, and 2.27 of stringobject.h.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 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)
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant