• Re: unordered_map vs. map

    From Andrey Tarasevich@21:1/5 to Bonita Montero on Fri Mar 1 18:45:02 2024
    On 03/01/24 7:03 AM, Bonita Montero wrote:
    I had the idea that an unordered_map with copying the contents to a
    vector and sorting afterwards might be faster than constructing a
    similar map<>, which is sorted by nature. So I wrote some code for

    Um... This is common knowledge. In general case, if have you all your
    data available to you in advance, it is always faster to use a good
    off-line sorting algorithm than an on-line sorting algorithm.

    The on-line nature of `std::map`-based sorting is the luxury for which
    you pay in extra overhead.

    --
    Best regards,
    Andrey

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)