nsTArray_Impl::Assign/operator= copying from another array cause code bloat and is inefficient in the infallible case
Categories
(Core :: XPCOM, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox81 | --- | fixed |
People
(Reporter: sg, Assigned: sg)
References
Details
Attachments
(1 file)
nsTArray_Impl::Assign/operator=
copying from another array cause code bloat by using ReplaceElementsAtInternal
without exploiting the knowledge that the whole array is being replaced. Since for many instances of the class template, this is the only ReplaceElementsAtInternal
call being done, this unnecessary bloats the generated code. Apart from that, it is suboptimal at runtime due to unnecessary checks.
Furthermore, the implementation of ReplaceElementsAtInternal
may unnecessarily relocate the existing elements before destroying them if the storage needs to be reallocated. While this could be optimized in ReplaceElementsAtInternal
as well, it is simpler to do so in the specialized AssignInternal
that is now introduced.
Assignee | ||
Comment 1•5 years ago
|
||
nsTArray_Impl::Assign/operator= copying from another array cause code bloat by
using ReplaceElementsAtInternal without exploiting the knowledge that the whole
array is being replaced. Since for many instances of the class template, this
is the only ReplaceElementsAtInternal call being done, this unnecessary bloats
the generated code. Apart from that, it is suboptimal at runtime due to
unnecessary checks.
Furthermore, the implementation of ReplaceElementsAtInternal may unnecessarily
relocate the existing elements before destroying them if the storage needs to
be reallocated. While this could be optimized in ReplaceElementsAtInternal as
well, it is simpler to do so in the specialized AssignInternal that is now
introduced.
Assignee | ||
Updated•5 years ago
|
Comment 3•5 years ago
|
||
bugherder |
Description
•