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

imghdr test order makes it slow #47674

Closed
biny mannequin opened this issue Jul 22, 2008 · 6 comments
Closed

imghdr test order makes it slow #47674

biny mannequin opened this issue Jul 22, 2008 · 6 comments
Labels
performance Performance or resource usage stdlib Python modules in the Lib dir

Comments

@biny
Copy link
Mannequin

biny mannequin commented Jul 22, 2008

BPO 3424
Nosy @benjaminp
Files
  • current: Unoptimized
  • optimized: optimized
  • 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 2008-08-16.16:29:28.786>
    created_at = <Date 2008-07-22.09:30:38.898>
    labels = ['library', 'performance']
    title = 'imghdr test order makes it slow'
    updated_at = <Date 2008-08-16.16:29:28.785>
    user = 'https://bugs.python.org/biny'

    bugs.python.org fields:

    activity = <Date 2008-08-16.16:29:28.785>
    actor = 'benjamin.peterson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2008-08-16.16:29:28.786>
    closer = 'benjamin.peterson'
    components = ['Library (Lib)']
    creation = <Date 2008-07-22.09:30:38.898>
    creator = 'biny'
    dependencies = []
    files = ['10958', '10959']
    hgrepos = []
    issue_num = 3424
    keywords = []
    message_count = 6.0
    messages = ['70142', '70146', '70168', '70507', '70649', '71224']
    nosy_count = 2.0
    nosy_names = ['benjamin.peterson', 'biny']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue3424'
    versions = ['Python 2.5']

    @biny
    Copy link
    Mannequin Author

    biny mannequin commented Jul 22, 2008

    The order of tests in imghdr makes it slow in common cases. Even without
    any statistics it is quite easy to see that jpeg is the most common
    format. In imghdr only bmp and png are after it. Also, should png really
    be the last one?

    Nearly all digital cameras produce jpegs and handling such images is one
    big use case for this module.

    Changing the test order should be easy and have big effect in common use
    cases.

    @biny biny mannequin added stdlib Python modules in the Lib dir performance Performance or resource usage labels Jul 22, 2008
    @benjaminp
    Copy link
    Contributor

    Do you have any benchmarks to prove this with? IMO, the difference would
    be extremely insignificant.

    @biny
    Copy link
    Mannequin Author

    biny mannequin commented Jul 23, 2008

    Naturally it requires a big amount of files. Getting big amount of jpegs
    is easy. Getting big amount of pbms or rgbs is not so easy.

    I'll attach two profiling runs showing some difference when test_jpeg
    and test_exif are moved to be the first tests. The beginnings those
    outputs show the return value counts.

    @benjaminp
    Copy link
    Contributor

    Ok. Would you like to propose an alternate order?

    @biny
    Copy link
    Mannequin Author

    biny mannequin commented Aug 3, 2008

    jpeg
    exif
    png
    gif
    tiff

    and then the rest

    @benjaminp
    Copy link
    Contributor

    Done in r65713.

    @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
    performance Performance or resource usage stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant