Repository navigation
Closed
Labels
3.11only security fixesperformancePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directory
Description
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 2022-01-05.12:18:52.858>
created_at = <Date 2021-12-22.09:00:00.473>
labels = ['3.11', 'library', 'performance']
title = 'Optimize pathlib'
updated_at = <Date 2022-01-09.09:41:34.187>
user = 'https://github.com/kumaraditya303'bugs.python.org fields:
activity = <Date 2022-01-09.09:41:34.187>
actor = 'kumaraditya'
assignee = 'none'
closed = True
closed_date = <Date 2022-01-05.12:18:52.858>
closer = 'kumaraditya'
components = ['Library (Lib)']
creation = <Date 2021-12-22.09:00:00.473>
creator = 'kumaraditya'
dependencies = []
files = []
hgrepos = []
issue_num = 46148
keywords = ['patch']
message_count = 10.0
messages = ['409015', '409023', '409025', '409026', '409048', '409059', '409060', '409064', '409758', '409773']
nosy_count = 7.0
nosy_names = ['pitrou', 'christian.heimes', 'eric.araujo', 'josh.r', 'Dennis Sweeney', 'FFY00', 'barneygale']
pr_nums = ['30226', '27828', '30492']
priority = 'normal'
resolution = 'postponed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'performance'
url = 'https://bugs.python.org/issue46148'
versions = ['Python 3.11']Metadata
Metadata
Assignees
Labels
3.11only security fixesperformancePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directory
Activity
kumaraditya303 commentedon Dec 22, 2021
Issue for tracking improving performance of pathlib module.
tiran commentedon Dec 22, 2021
Please provide benchmarks and reasons in the ticket. A BPO issue should contain all relevant information for a change.
kumaraditya303 commentedon Dec 22, 2021
Optimizations include:
kumaraditya303 commentedon Dec 22, 2021
Benchmarks for attrgetter is provided in the PR.
gvanrossum commentedon Dec 22, 2021
I presume faster-cpython/ideas#194 is also relevant.
MojoVampire commentedon Dec 23, 2021
Note: attrgetter could easily be made faster by migrating it to use vectorcall.
gvanrossum commentedon Dec 23, 2021
Sure, though code that *doesn't* use attrgetter is usually easier to read -- attrgetter is rare enough in my experience that I usually have to look it up. So making attrgetter unnecessary in most cases would also be welcome.
(The exception is when you have many trivial pass-through properties, or when the attribute name is a variable to begin with.)
sweeneyde commentedon Dec 23, 2021
I have #27828 open already to add vectorcall to itemgetter and attrgetter
kumaraditya303 commentedon Jan 5, 2022
I am withdrawing this for now and since there is already a bpo for vectorcall I am closing this.
merwok commentedon Jan 5, 2022
A note about benchmarks: I think timeit is not the right tool for them, but https://github.com/python/pyperformance is