[Alex] > ... > If we can make some simplified assumptions about transition locations and > sizes, we can avoid a binary search over seconds to locate the transitions > via POSIX localtime/mktime APIs.
BTW, "the obvious" way to almost always avoid binary search is for a tzinfo to remember the index of the last transition it had to use, then next time start a linear search from there. It should usually succeed in 1 or 2 tries. Programs in real life don't jump around across all possible times at random. To be truly insane, it could meld linear search with binary search, like Python's listsort.c's "gallop" functions. I'd say that's far more trouble than it's worth in this context, though. Simple linear search with a search finger (index saved across searches) should do fine. _______________________________________________ Datetime-SIG mailing list [email protected] https://mail.python.org/mailman/listinfo/datetime-sig The PSF Code of Conduct applies to this mailing list: https://www.python.org/psf/codeofconduct/
