-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
chronoC++20 chronoC++20 chronofixedSomething works now, yay!Something works now, yay!performanceMust go fasterMust go faster
Description
Each
vectorin atzdbobject is sorted to enable fast lookup.
The time zone names are sorted in the tzdb produced by MSVC's STL1, but locate_zone performs a linear search. It could be changed to a binary search, which would be faster.
Lines 2106 to 2110 in 41ec195
| template <class _Ty> | |
| _NODISCARD const _Ty* _Locate_zone_impl(const vector<_Ty>& _Vec, string_view _Name) { | |
| const auto _Result = _STD find_if(_Vec.begin(), _Vec.end(), [&](auto& _Tz) { return _Tz.name() == _Name; }); | |
| return _Result == _Vec.end() ? nullptr : &*_Result; | |
| } |
This is slightly more advanced than a "good first issue", requiring the contributor to understand how to perform binary search using std::lower_bound (not std::binary_search!).
Footnotes
-
The data are obtained from ICU, and eventually from the
zoneinfo64resource.zoneinfo64is generated bytz2icu, which sorts the names by using astd::map. ↩
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
chronoC++20 chronoC++20 chronofixedSomething works now, yay!Something works now, yay!performanceMust go fasterMust go faster