jhanarato / uposatha

Buddhist Moon Days
MIT License
1 stars 1 forks source link

Allow access to holiday via uposatha #13

Closed jhanarato closed 10 months ago

jhanarato commented 10 months ago

At the moment we have a bunch of frozen dataclasses. Season has Uposatha instances and Holiday instances that have an Uposatha. Given an Uposatha, we'd like to access the Holiday that falls on it.

Plan is: after creating the above data classes, pass the list of Seasons and make a mapping of Uposatha to Season. Uposatha will have property season that is optional, None if there is no holiday on this uposatha.

jhanarato commented 10 months ago

elements.py has a lookup now. It remains empty when calendar is created.

Our benchmark at this point:

------------------------------------------------ benchmark: 1 tests -----------------------------------------------
Name (time in ms)               Min     Max    Mean  StdDev  Median     IQR  Outliers       OPS  Rounds  Iterations
-------------------------------------------------------------------------------------------------------------------
test_initialise_calendar     1.4247  7.0630  1.5689  0.7217  1.4445  0.0370     13;26  637.3931     559           1
-------------------------------------------------------------------------------------------------------------------
jhanarato commented 10 months ago

Lookup implemented and looks shmick.

New benchmark:

------------------------------------------------ benchmark: 1 tests -----------------------------------------------
Name (time in ms)               Min     Max    Mean  StdDev  Median     IQR  Outliers       OPS  Rounds  Iterations
-------------------------------------------------------------------------------------------------------------------
test_initialise_calendar     1.5062  7.7579  1.6518  0.7142  1.5246  0.0414     13;23  605.4142     543           1
-------------------------------------------------------------------------------------------------------------------

An extra 0.75ms creation time, or 10% increase, not bad.