Skip to content

str.translate is absurdly slow in majority of use cases (takes up to 60x longer than similar functions) #65317

@MojoVampire

Description

@MojoVampire
BPO 21118
Nosy @pitrou, @vstinner, @ezio-melotti, @serhiy-storchaka, @MojoVampire
Files
  • translate_timing.py: File to time various ways of using str.translate and its "competing" functions
  • translate_writer.patch
  • translate_script.py
  • translate_writer_bench.txt
  • fast_translate.patch
  • translate_script_ascii.py
  • translate_cached.patch
  • translate_cached_2.patch
  • bench_translate.py
  • 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 2014-04-05.13:03:50.934>
    created_at = <Date 2014-03-31.23:09:06.297>
    labels = ['expert-unicode', 'performance']
    title = 'str.translate is absurdly slow in majority of use cases (takes up to 60x longer than similar functions)'
    updated_at = <Date 2014-04-08.07:14:31.298>
    user = 'https://github.com/MojoVampire'

    bugs.python.org fields:

    activity = <Date 2014-04-08.07:14:31.298>
    actor = 'python-dev'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-04-05.13:03:50.934>
    closer = 'vstinner'
    components = ['Unicode']
    creation = <Date 2014-03-31.23:09:06.297>
    creator = 'josh.r'
    dependencies = []
    files = ['34688', '34691', '34727', '34728', '34731', '34732', '34734', '34736', '34744']
    hgrepos = []
    issue_num = 21118
    keywords = ['patch']
    message_count = 31.0
    messages = ['215283', '215301', '215339', '215387', '215473', '215538', '215539', '215540', '215541', '215551', '215552', '215553', '215576', '215577', '215586', '215587', '215594', '215598', '215599', '215600', '215602', '215606', '215610', '215612', '215673', '215676', '215678', '215680', '215685', '215686', '215742']
    nosy_count = 6.0
    nosy_names = ['pitrou', 'vstinner', 'ezio.melotti', 'python-dev', 'serhiy.storchaka', 'josh.r']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue21118'
    versions = ['Python 3.4', 'Python 3.5']

    Metadata

    Metadata

    Assignees

    No one assigned

      Projects

      No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions