Open Bug 1697377 Opened 3 years ago

Ensure that keys are not unnecessarily copied in nsTHashtable/nsBaseHashtable operations

Categories

(Core :: XPCOM, task)

task

Tracking

()

People

(Reporter: sg, Unassigned)

References

Details

Currently, the keys of nsTHashtable/nsBaseHashtable instance are always copied. However, already for standard key types such as strings or RefPtr<T>, it would be beneficial to move them. This is particularly relevant for set-like uses that don't have an associated value at all.

This is currently partially addressed by using decayed types as the user-visible keytype (such as T* for RefPtr<T>) or const& KeyTypes, so that on lookup operations no copying is performed. However, when inserting entries, it is currently impossible to move the key.

You need to log in before you can comment on or make changes to this bug.