Date: Sun, 29 Nov 2026 08:06:57 +0300
Correction!: "(key1, value2) argument" is about std:unordered_map not about
std::unordered set. I will elaborate a little bit on it: if you have (key1.
value1) already in place to std:unordered_set S structure, and you make
something like "S[key2] = value2" where key1 != key2, but CompPred(key1,
key2) is true, so you're overwriting the value and will get (key1, value2)
pair in place after all. It might be a possible source of error due to
unwanted (key1, value2) combination which might be used further, let's say
after "extract".
You wrote "the size of the key is the least of the problems" :DDDD
So if you're using only, let'say, 1% of Key object size for "CompPred"
comparison, and you still put other 99% of Key to the unordered_set
structure (99% is not used for Key comparison, but just occupies space in
memory) - it make 100 times more usage of the CPU cache.
вс, 29 нояб. 2026 г. в 03:45, Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]>:
> On Saturday, 28 November 2026 15:24:13 Pacific Standard Time Aleksandr
> Povaliaev via Std-Proposals wrote:
> > I wrote: "Second, this is an ineffective way of storing Key in
> > cache-friendly unordered_set structure (not so friendly 😀 but more
> > friendly then, let's say, std::set)."
>
> unordered_set is not cache-friendly in the first place. The size of the
> key is
> the least of the problems. And besides, what matters is the total payload
> size
> (key + value), so moving from the key to the payload changes absolutely
> nothing.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Principal Engineer - Intel Data Center - Platform & Sys. Eng.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
std::unordered set. I will elaborate a little bit on it: if you have (key1.
value1) already in place to std:unordered_set S structure, and you make
something like "S[key2] = value2" where key1 != key2, but CompPred(key1,
key2) is true, so you're overwriting the value and will get (key1, value2)
pair in place after all. It might be a possible source of error due to
unwanted (key1, value2) combination which might be used further, let's say
after "extract".
You wrote "the size of the key is the least of the problems" :DDDD
So if you're using only, let'say, 1% of Key object size for "CompPred"
comparison, and you still put other 99% of Key to the unordered_set
structure (99% is not used for Key comparison, but just occupies space in
memory) - it make 100 times more usage of the CPU cache.
вс, 29 нояб. 2026 г. в 03:45, Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]>:
> On Saturday, 28 November 2026 15:24:13 Pacific Standard Time Aleksandr
> Povaliaev via Std-Proposals wrote:
> > I wrote: "Second, this is an ineffective way of storing Key in
> > cache-friendly unordered_set structure (not so friendly 😀 but more
> > friendly then, let's say, std::set)."
>
> unordered_set is not cache-friendly in the first place. The size of the
> key is
> the least of the problems. And besides, what matters is the total payload
> size
> (key + value), so moving from the key to the payload changes absolutely
> nothing.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Principal Engineer - Intel Data Center - Platform & Sys. Eng.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2026-11-29 05:07:13
