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

>100k alloc wasted on startup #39808

Closed
mikesfpy mannequin opened this issue Jan 12, 2004 · 3 comments
Closed

>100k alloc wasted on startup #39808

mikesfpy mannequin opened this issue Jan 12, 2004 · 3 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@mikesfpy
Copy link
Mannequin

mikesfpy mannequin commented Jan 12, 2004

BPO 875689
Nosy @tim-one, @rhettinger
Files
  • intobject.c.diff: Patch vs. Objects/intobject.c
  • 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/rhettinger'
    closed_at = <Date 2004-02-08.18:59:53.000>
    created_at = <Date 2004-01-12.21:30:50.000>
    labels = ['interpreter-core']
    title = '>100k alloc wasted on startup'
    updated_at = <Date 2004-02-08.18:59:53.000>
    user = 'https://bugs.python.org/mikesfpy'

    bugs.python.org fields:

    activity = <Date 2004-02-08.18:59:53.000>
    actor = 'rhettinger'
    assignee = 'rhettinger'
    closed = True
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2004-01-12.21:30:50.000>
    creator = 'mikesfpy'
    dependencies = []
    files = ['5781']
    hgrepos = []
    issue_num = 875689
    keywords = ['patch']
    message_count = 3.0
    messages = ['45236', '45237', '45238']
    nosy_count = 3.0
    nosy_names = ['tim.peters', 'rhettinger', 'mikesfpy']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue875689'
    versions = []

    @mikesfpy
    Copy link
    Mannequin Author

    mikesfpy mannequin commented Jan 12, 2004

    A glaring error in Objects/intobject.c function _PyInt_Init():

    It allocates a whole BLOCK of ints each time through the loop
    (i.e. 106 blocks of 1K size) and not just 106 int objects.

    Allocating 106 blocks means a preallocation of more than 8600
    int objects which is VERY unlikely to be needed by most programs.
    So this bug wastes more than 100K on every startup.

    The appended patch is vs. the current CVS. The bug is present
    in 2.3.* and also in 2.2.? (not sure if I interpret the CVS logs right).

    If you don't believe that this bug exists, just add a putc('#',stderr);
    right before the code in fill_free_list() and see what happens when
    you startup python. :-)

    @mikesfpy mikesfpy mannequin closed this as completed Jan 12, 2004
    @mikesfpy mikesfpy mannequin assigned rhettinger Jan 12, 2004
    @mikesfpy mikesfpy mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Jan 12, 2004
    @tim-one
    Copy link
    Member

    tim-one commented Jan 12, 2004

    Logged In: YES
    user_id=31435

    Good eye! Your analysis is correct, and the patch looks good
    too. It's probably bad that the current code is spraying
    the "frequently used" little integers all over memory too. The
    patch also fixes that.

    @rhettinger
    Copy link
    Contributor

    Logged In: YES
    user_id=80475

    Accepted and applied to Objects/intobject.c 2.108 and 2.105.8.1
    .

    @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

    2 participants