This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Unnecessary Cache of Shared Object Handles
Type: Stage: resolved
Components: Versions: Python 3.11
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: Ian.H, brett.cannon, eric.snow, gregory.p.smith, ncoghlan, twouters
Priority: normal Keywords: patch

Created on 2021-04-20 17:00 by Ian.H, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 25487 merged Ian.H, 2021-04-23 19:04
Messages (4)
msg391453 - (view) Author: Ian H (Ian.H) * Date: 2021-04-20 17:00
While working on another project I noticed that there's a cache of shared object handles kept inside _PyImport_FindSharedFuncptr. See It appears to be an optimization to work around poor caching of shared object handles in old libc implementations. After some testing, I have been unable to find any meaningful performance difference from this cache, so I propose we remove it to save the space.

My initial tests were on Linux (Ubuntu 18.04). I saw no discernible difference in the time for running the Python test suite with a single thread. Running the test suite using a single thread shows a lot of variance, but after running with and without the cache 40 times the mean times with/without the cache was nearly the same. Interpreter startup time also appears to be unaffected. This was all with a debug build, so I'm in the process of collecting data with a release build to see if that changes anything.
msg391454 - (view) Author: Ian H (Ian.H) * Date: 2021-04-20 17:03
Proposed patch is in
msg397122 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2021-07-07 23:26
New changeset fed2fc4443235fa9669b73817827fd6da88e3417 by Ian Henriksen in branch 'main':
bpo-43895: Remove an unnecessary cache of shared object handles (GH-25487)
msg397123 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2021-07-07 23:26
Thanks Ian!
Date User Action Args
2022-04-11 14:59:44adminsetgithub: 88061
2021-07-07 23:26:50gregory.p.smithsetstatus: open -> closed
versions: - Python 3.10
messages: + msg397123

resolution: fixed
stage: patch review -> resolved
2021-07-07 23:26:14gregory.p.smithsetmessages: + msg397122
2021-07-06 03:57:59gregory.p.smithsetassignee: gregory.p.smith

nosy: + twouters, gregory.p.smith
versions: + Python 3.11
2021-04-23 19:05:52eric.araujosetnosy: + brett.cannon, ncoghlan, eric.snow
2021-04-23 19:04:54Ian.Hsetkeywords: + patch
stage: patch review
pull_requests: + pull_request24282
2021-04-20 17:03:22Ian.Hsetmessages: + msg391454
2021-04-20 17:00:51Ian.Hcreate