Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

opening_hours: use compiled library instead of JS wrapper #176

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

remi-dupre
Copy link
Contributor

It is still very experimental but a good proof that there is not so much work left to do :)

@remi-dupre
Copy link
Contributor Author

@amatissart after your merged #192 I was curious to see how using a compiled library for parsing opening hours could help.

This is not a huge surprise but calls often take a to a millisecond, this implementation is still quite naive and ome cheap optimizations could be performed.

is_open(2021-02-05 07:56:26.925039+00:00) in 0.000047s
get_open_intervals(2021-01-31 00:00:00+01:00, 2021-02-03 00:00:00+01:00) in 0.001242s
get_open_intervals_at_date(2021-02-01, overlap_next_day=True) in 0.001590s
get_open_intervals(2021-02-01 00:00:00+01:00, 2021-02-04 00:00:00+01:00) in 0.001207s
get_open_intervals_at_date(2021-02-02, overlap_next_day=True) in 0.001552s
get_open_intervals(2021-02-02 00:00:00+01:00, 2021-02-05 00:00:00+01:00) in 0.001524s
get_open_intervals_at_date(2021-02-03, overlap_next_day=True) in 0.001874s
get_open_intervals(2021-02-03 00:00:00+01:00, 2021-02-06 00:00:00+01:00) in 0.001144s
get_open_intervals_at_date(2021-02-04, overlap_next_day=True) in 0.001463s
get_open_intervals(2021-02-04 00:00:00+01:00, 2021-02-07 00:00:00+01:00) in 0.001163s
get_open_intervals_at_date(2021-02-05, overlap_next_day=True) in 0.001470s
get_open_intervals(2021-02-05 00:00:00+01:00, 2021-02-08 00:00:00+01:00) in 0.001132s
get_open_intervals_at_date(2021-02-06, overlap_next_day=True) in 0.001432s
get_open_intervals(2021-02-06 00:00:00+01:00, 2021-02-09 00:00:00+01:00) in 0.001166s
get_open_intervals_at_date(2021-02-07, overlap_next_day=True) in 0.001470s

Opening hours "specification" is really a huge mess ^^'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant