GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Verify the etree_parse and etree_iterparse benchmarks are working appropriately · Issue #69824 · python/cpython

Verify the etree_parse and etree_iterparse benchmarks are working appropriately #69824

New issue
Copy link
New issue
Copy link
Closed
Closed
Verify the etree_parse and etree_iterparse benchmarks are working appropriately#69824
Copy link
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirperformancePerformance or resource usagePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-XML

Description

@brettcannon
brettcannon
opened on Nov 16, 2015
Issue body actions
BPO 25638
Nosy @brettcannon, @pitrou, @scoder, @serhiy-storchaka
PRs
  • [WIP] bpo-35502: Fix memory leak in xml.etree iterparse() #11169
  • Dependencies
  • bpo-25814: Propagate all errors from ElementTree.iterparse
  • Files
  • etree_iterparse.patch
  • etree_iterparse_2.patch
  • etree_start_handler_no_attrib.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 2016-03-12.17:21:48.895>
    created_at = <Date 2015-11-16.19:41:23.215>
    labels = ['extension-modules', 'expert-XML', 'library', 'invalid', 'performance']
    title = 'Verify the etree_parse and etree_iterparse benchmarks are working appropriately'
    updated_at = <Date 2018-12-14.22:10:01.246>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2018-12-14.22:10:01.246>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-03-12.17:21:48.895>
    closer = 'brett.cannon'
    components = ['Extension Modules', 'Library (Lib)', 'XML', 'Benchmarks']
    creation = <Date 2015-11-16.19:41:23.215>
    creator = 'brett.cannon'
    dependencies = ['25814']
    files = ['41110', '41167', '41276']
    hgrepos = []
    issue_num = 25638
    keywords = ['patch']
    message_count = 20.0
    messages = ['254746', '254748', '254751', '254752', '254753', '254763', '254764', '255021', '255024', '255027', '255050', '255394', '255936', '256013', '256039', '256059', '256158', '256167', '256172', '261651']
    nosy_count = 6.0
    nosy_names = ['brett.cannon', 'pitrou', 'scoder', 'eli.bendersky', 'python-dev', 'serhiy.storchaka']
    pr_nums = ['11169']
    priority = 'normal'
    resolution = 'not a bug'
    stage = None
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue25638'
    versions = ['Python 3.6']

    Activity

    Next
    1. brettcannon commented on Nov 16, 2015

      @brettcannon
      brettcannon
      on Nov 16, 2015
      MemberAuthor
      More actions

      If you look at bit.ly/pycon-ca-keynote you will notice that the etree_parse and etree_iterparse benchmarks were horrible for everyone. Because of how badly everyone seemed to do, I think the benchmarks should be verified to be doing reasonable things on implementations other than CPython 2.7.

    2. brettcannon
      added
      performancePerformance or resource usagePerformance or resource usage
      on Nov 16, 2015
    3. brettcannon
      self-assigned this
      on Nov 16, 2015
    4. pitrou commented on Nov 16, 2015

      @pitrou
      pitrou
      on Nov 16, 2015
      Member
      More actions

      Would you have a quick summary for those not willing to watch a whole keynote?

    5. brettcannon commented on Nov 16, 2015

      @brettcannon
      brettcannon
      on Nov 16, 2015
      MemberAuthor
      More actions

      That link is to a Jupyter notebook so you don't have to watch anything. Plus the video is not even up yet so you can't skip the keynote even if you wanted to since you can't watch it yet. :)

    6. pitrou commented on Nov 16, 2015

      @pitrou
      pitrou
      on Nov 16, 2015
      Member
      More actions

      Ok, so when you say "horrible for everyone", this is really IronPython and Jython, right? :-) Other runtimes seem to do ok (perhaps not stellar, but ok).

    7. brettcannon commented on Nov 16, 2015

      @brettcannon
      brettcannon
      on Nov 16, 2015
      MemberAuthor
      More actions

      Well, Jython and IronPython obviously did the worst, but even Python 3 didn't do as well as I would have expected, so I still want to double-check the benchmarks to see if it's obvious why CPython 2.7 beats out everyone.

    8. serhiy-storchaka commented on Nov 16, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Nov 16, 2015
      Member
      More actions

      I think these histograms would look better with logarithmic scale.

    9. brettcannon commented on Nov 16, 2015

      @brettcannon
      brettcannon
      on Nov 16, 2015
      MemberAuthor
      More actions

      Let's not pollute the issue with a critique of my notebook. You can feel free to email me personally to discuss it if you want, including why I purposefully didn't use a logarithmic scale.

    10. serhiy-storchaka commented on Nov 20, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Nov 20, 2015
      Member
      More actions

      Sorry Brett.

      How tests were ran? There are two implementations of ElementTree, accelerated and non-accelerated. xml.etree.ElementTree by default is accelerated in Python 3, but non-accelerated in Python 2.

      $ python2.7 bm_elementtree.py -n 7 --take_geo_mean 
      0.463665158795
      $ python2.7 bm_elementtree.py -n 7 --take_geo_mean --etree-module=xml.etree.ElementTree
      5.46309932568
      $ python3.4 bm_elementtree.py -n 7 --take_geo_mean --etree-module=xml.etree.ElementTree
      0.813397633467649
      $ python3.4 bm_elementtree.py -n 7 --take_geo_mean --etree-module=xml.etree.ElementTree --no-accelerator
      5.31174765817514

      If run the test with the same options --etree-module=xml.etree.ElementTree, it will use accelerated implementation in Python 3 and non-accelerated in Python 2.

    11. brettcannon commented on Nov 20, 2015

      @brettcannon
      brettcannon
      on Nov 20, 2015
      MemberAuthor
      More actions

      The commands I used are in the notebook for each implementation and you can get the same result with python3 perf.py -b etree python2 python3.

    12. serhiy-storchaka commented on Nov 20, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Nov 20, 2015
      Member
      More actions

      The slowing down Python 3 can be related to adding XMLPullParser (bpo-17741).

    13. serhiy-storchaka commented on Nov 21, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Nov 21, 2015
      Member
      More actions

      Proposed patch optimizes iterparse(). Now it is only 33% slower than in 2.7 (was 2.6 times slower).

    14. serhiy-storchaka
      added
      extension-modulesC modules in the Modules dirC modules in the Modules dir
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      on Nov 21, 2015
    15. 2 remaining items

    16. serhiy-storchaka commented on Nov 26, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Nov 26, 2015
      Member
      More actions

      Updated to tip.

    17. brettcannon commented on Dec 5, 2015

      @brettcannon
      brettcannon
      on Dec 5, 2015
      MemberAuthor
      More actions

      Serhiy's latest patch LGTM.

    18. brettcannon
      assigned
      serhiy-storchaka
      and unassigned
      brettcannon
      on Dec 5, 2015
    19. serhiy-storchaka commented on Dec 6, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Dec 6, 2015
      Member
      More actions

      Thank you for your review Brett. First than apply this optimization I want to fix errors propagating issue (bpo-25814). The patch for it is mainly the simplified part of the patch for this issue.

    20. python-dev commented on Dec 7, 2015

      @python-dev
      python-devmannequin
      on Dec 7, 2015
      Mannequin
      More actions

      New changeset dd67c8c53aea by Serhiy Storchaka in branch 'default':
      Issue bpo-25638: Optimized ElementTree.iterparse(); it is now 2x faster.
      https://hg.python.org/cpython/rev/dd67c8c53aea

    21. serhiy-storchaka commented on Dec 7, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Dec 7, 2015
      Member
      More actions

      The iterparse benchmark in 3.6 still is 30% slower than in 2.7. The parse benchmark is 70% slower. Hence there are other causes of the slowing down.

      One of causes is that in 3.x an empty dict instead of None is passed to start handler as attrib parameter if the start tag has no attributes. This makes parsing parsing about 10% slower.

    22. serhiy-storchaka commented on Dec 9, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Dec 9, 2015
      Member
      More actions

      Following patch speeds up ElementTree parsing (the result of the etree parse benchmark is improved by 10%). Actually it restores 2.7 code and avoids creating an empty dict for attributes if not needed.

    23. python-dev commented on Dec 10, 2015

      @python-dev
      python-devmannequin
      on Dec 10, 2015
      Mannequin
      More actions

      New changeset 1fe904420c20 by Serhiy Storchaka in branch 'default':
      Issue bpo-25638: Optimized ElementTree parsing; it is now 10% faster.
      https://hg.python.org/cpython/rev/1fe904420c20

    24. serhiy-storchaka commented on Dec 10, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on Dec 10, 2015
      Member
      More actions

      Thank you for your review Brett. Now the parse benchmark in 3.6 is only 50% slower than in 2.7. Will continue to find bottlenecks.

    25. serhiy-storchaka commented on Mar 12, 2016

      @serhiy-storchaka
      serhiy-storchaka
      on Mar 12, 2016
      Member
      More actions

      I am not able to find the cause of the slowdown.

      I think this issue can be closed now. The etree_parse and etree_iterparse benchmarks are working appropriately and showing real regression in CPython 3.x. The cause of the regression is not known.

    26. serhiy-storchaka
      removed their assignment
      on Mar 12, 2016
    27. brettcannon
      closed this as completedon Mar 12, 2016
    28. brettcannon
      added
      invalid
      on Mar 12, 2016
    29. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      extension-modulesC modules in the Modules dirC modules in the Modules dirperformancePerformance or resource usagePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-XML

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.