You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
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
assignee=Noneclosed_at=<Date2018-01-16.18:07:46.382>created_at=<Date2017-12-21.21:51:14.443>labels= ['3.8', 'type-feature', '3.7']
title='date, time and datetime alternate constructors should take fast construction path'updated_at=<Date2018-02-27.19:58:30.646>user='https://github.com/pganssle'
In the addition of the fromisoformat() alternate constructor (bpo-15873: #4699), I noted that I was able to get some significant speedup by special-casing the datetime baseclass in the C code so that it bypasses the Python constructor, by replacing code that looks like this:
(This is for date, but the results are even more striking for datetime).
In my initial proof of concept implementation of a new_date_subclass_ex method, I've seen (this is not compiled with optimizations on, mind you) speedups for the other constructors as well:
As you can see, this is a fairly significant speedup in the common case with no cost in the unusual case and no change in behavior. I propose that we switch over all the C constructors where it makes sense to do so in date, time and datetime.