Closed qwhelan closed 1 year ago
The backstory on this PR is that I noticed dali
was spending a surprisingly large amount of time reading my .csv
files before even getting to the stage of hitting the network for price information. So it's impactful in my case but that doesn't necessarily make it worth it for everyone else.
Given datetime.fromisoformat()
exists since Python 3.7, just with a very limited supported format, we could just drop the backport module and keep the fallback behavior. It's not going to be as beneficial as 3.7-3.10 users will fall back to dateutil
at a much higher rate, but we also don't need to explicitly drop support in that case.
As part of Python 3.11,
datetime.fromisoformat()
greatly expanded its supported formats, which makes it more broadly useful; thebackports.datetime_fromisoformat
package extends support for this functionality back to Python 3.7.Notably,
datetime.fromisoformat()
is about 400x faster thandateutil.parser.parse()
:The latter's runtime is the vast majority of the time taken for
AbstractTransaction.__init__()
:Which contributes to the slow transaction creation time:
Utilizing
backport.datetime_fromisoformat
halves the creation time of a transaction when parse-able bydatetime.fromisoformat()
: