Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-121807

Rework QTimeZone construction from backend to skip is-available check



    • All
    • 3
    • 00d9a9a9b (dev), 74c59f8a2 (6.7), ec9ca7ac4 (dev), a3a2d3df2 (6.7), 9f304ee3e (6.6), e5b3c0bb1 (6.6), 078111d80 (tqtc/lts-6.5)
    • Foundation Sprint 100, Foundation Sprint 101


      At present, QTZ's constructor from IANA ID (after trying a UTC zone) checks whether the ID is avaliable before calling the backend-constructor on it. On some platforms, this check duplicates work the constructor has to do in any case, which is wasteful. The check is there because, IIRC, there's a backend whose constructor will happily accept any old garbage and give you a GMT-zone backend instead of an invalid one; but backends with this defect should bear the cost of the is-available check, rather than imposing it on their peers.

      In a related matter, QTZP provides a fall-back implementation of the is-available check by seeing if the ID is present in the all-available-IDs list; but computing and searching that list can be highly expensive. In backends where it is possible to do a cheaper check for is-available, the is-available method should be overridden (it is virtual). In backends where constructing the list is expensive, it should be cached (if possible).

      This should mostly be achievable by rearranging existing code; cheaper is-available checks can typically be obtained by adapting the code in the constructor, where it only succeeds for valid IDs; caching all-available lists just involves a static local member in the all-available method, initialised with its existing body as inline-called-lambda.

      Prompted by discussion on this review.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            Eddy Edward Welbourne
            Eddy Edward Welbourne
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            0 Vote for this issue
            3 Start watching this issue