Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastdatetime

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastdatetime

Like datetime, but fast

  • 0.3.2
  • PyPI
  • Socket score

Maintainers
1

fastdatetime

Like datetime, but fast 🚀

ImplementationInstallationFAQAcknowledgements

PyPI License

Implementation

strptime

In the pursuit of a faster strptime implementation, two backing Rust crates were chosen due to their popularity in the ecosystem – chrono and time.

Both impementations are exposed under the following methods:

  1. fastdatetime.strptime (based on time along with time-fmt)
  2. fastdatetime.chrono.strptime (based on chrono)

Initially, chrono seemed liked a drop-in replacement, however due to subtle differences of %f specifier the format argument needs to preprocessed to conform to the Python referece which incurs slight performance overhead as the format string needs to be scanned. Furthermore, even without this shortcoming, the parsing was slower compared to time.

What's also interesting is that time doesn't support strptime compatible inferface out of the box – fortunatelly time-fmt does (in addition, some fixes and new functionality was upstreamed to the crate).

parse

Oftentimes the date format is not known ahead of time, or it is not possible to infer it from a few samples. In Python, one would usually opt for using the dateutil package, which can deal with all sorts of edge cases and is very forgiving, however these guarantees come at a cost – in order for the results to not be ambiguous but accurate, the user can tweak a lot of options (is the day or year first, ...) and has to sacrifice performance.

Enter dtparse by Bradlee Speice, a rewrite of dateutil.parse in Rust. Going full circle, fastdatetime just exposes Python bindings to Bradlee's excellent crate. This yields ~15x faster parsing performance (657 vs 42 Kops/sec on M1 Pro).

Installation

TBD

FAQ

TBD

Acknowledgements

License

© 2022 Contributors of Project fastdatetime.

This project is licensed under either of

at your option.

The SPDX license identifier for this project is MIT OR Apache-2.0.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc