-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
bpo-32348: Optimize asyncio.Future schedule/add/remove callback. #4907
Conversation
After the change C future has |
I actually want to keep Python implementation simple (for educational purposes) and different (to catch any difference in semantics). |
Got it. Ok. |
Modules/_asynciomodule.c
Outdated
} | ||
else { | ||
assert(fut->fut_callback0 != NULL); | ||
assert(fut->fut_callbacks == NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These asserts seems too redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dropped them
Modules/_asynciomodule.c
Outdated
#define FI_FREELIST_MAXLEN 100 | ||
static futureiterobject *fi_freelist_head = NULL; | ||
static futureiterobject *fi_freelist_tail = NULL; | ||
static Py_ssize_t fi_freelist_len = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend LIFO than FIFO when implementing freelist.
It may be better CPU cache ratio.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to LIFO
https://bugs.python.org/issue32348