-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Improve ISO Date Performance for JSON #30496
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
Conversation
CI notwithstanding, this looks like a nice cleanup+speedup |
@@ -481,6 +477,19 @@ static char *PyDateTimeToIso(JSOBJ obj, JSONTypeContext *tc, size_t *len) { | |||
return result; | |||
} | |||
|
|||
/* JSON callback */ | |||
static char *PyDateTimeToIsoCallback(JSOBJ obj, JSONTypeContext *tc, |
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.
In another follow up I think I'll move the conversion routines to another file and keep only the core JSON serialization functionality within this ones; makes it a little easier to grok the difference between functions used as callbacks and those used to convert values into various formats
LGTM |
} | ||
|
||
castfunc(dataptr, &longVal, 1, NULL, 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.
do you need a Py_DECREF anywhere here?
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.
Don't think so - here's a snippet in NumPy where there is no DECREF
And testing locally did segfault when trying
thanks, might be worth a general whatsnew note for perf for json changes (e.g. list issues that impacted perf that you have done recently) |
Yea no problem; will address in follow up |
benchmarks below
Note that this mostly improves on DTI which on 0.25.3 can't even be written as ISO format, so I didn't add a whatsnew. Timedelta is the big bottleneck remaining