FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-113710: Fix updating of dict version tag and add watched dict stats by markshannon · Pull Request #115221 · python/cpython · GitHub

/ cpython Public

GH-113710: Fix updating of dict version tag and add watched dict stats - #115221

Merged
markshannon merged 8 commits into
python:mainfrom
faster-cpython:watched-dict-stats
Feb 12, 2024
Merged

GH-113710: Fix updating of dict version tag and add watched dict stats#115221
markshannon merged 8 commits into
python:mainfrom
faster-cpython:watched-dict-stats

Conversation

markshannon commented Feb 9, 2024
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

Fixes a regression introduced by #114592 where mutating a global variable would cause repeated de-optimizations.

Comment thread Include/cpython/pystats.h
uint64_t func_modification;
/* Modifying a dict that is being watched */
uint64_t watched_dict_modification;
uint64_t watched_globals_modification;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

How do these new stats relate to the existing builtin_dict one?

markshannon Feb 9, 2024
edited
Loading

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

They only apply to any watched dict, and watched module globals respectively.
Whereas the builtin dict count tracks any modification to the builtins, which are always watched

In theory watched_globals_modification + builtin_dict == watched_dict_modification
Although, as soon as we start watching any other dicts that will no longer be true.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

That makes sense, thanks.

Copy link
Copy Markdown
Member Author

The stats look good ~800 dict watchers fired instead of 8 million.

gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

So I take it PyDict_EVENT_CLONED is no longer special?

Copy link
Copy Markdown
Member Author

So I take it PyDict_EVENT_CLONED is no longer special?

It never was, it was (and still is) misnamed.

markshannon merged commit 8144661 into python:main Feb 12, 2024
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
markshannon deleted the watched-dict-stats branch August 6, 2024 10:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL