closeio / ciso8601

Fast ISO8601 date time parser for Python written in C
MIT License
564 stars 45 forks source link

Add `backports.datetime_fromisoformat` to the benchmarks #138

Closed movermeyer closed 1 year ago

movermeyer commented 1 year ago

What are you trying to accomplish?

Fixes #136.

What approach did you choose and why?

At first, I simply add it as another library like any other.

image

backports.datetime_fromisoformat is fast, thanks to it using the same lightweight time zone implementation as ciso8601, which means that it is actually faster than datetime.

This means that it will likely always be 2nd place on the chart. But it also means that as written it will always be the library of comparison:

image

Which seems a little awkward, since backports.datetime_fromisoformat will (by definition) never apply to the latest version of Python.

Ideas I considered:

After lots of fussing with it, I realized that I could simply change the comparison summary line.

I changed it so that it will only compare against libraries that support the latest version of Python, and updated the text to match:

ciso8601 takes 97.2 nsec, which is 1.8x faster than datetime (builtin), the next fastest Python 3.11 parser in this comparison.

What should reviewers focus on?

The impact of these changes

backports.datetime_fromisoformat is benchmarked and represented in the table.

movermeyer commented 1 year ago

I don't see the README updated in this change, will that come in a following PR?

No CHANGELOG entry is needed. Benchmarking scripts are not for end consumers, just for the generation of the performance charts in the README.

AlecRosenbaum commented 1 year ago

I didn't mean the changelog, I meant the readme (the screenshot from the PR description / linked readme.rst file?)

movermeyer commented 1 year ago

Oh yeah, that'll change will happen when I refresh https://github.com/closeio/ciso8601/pull/135