Commit fa6096c
committed
[WTF] Fix performance when creating Vectors from different constness
https://bugs.webkit.org/show_bug.cgi?id=299008
Reviewed by Chris Dumez.
For example, when you try to create a Vector<uint8_t> from a span<const uint8_t>, templates will consider both types
different and even when you pass true to the template, the second VectorCopier::uninitializedCopy function will be used
and will defer to the slow version.
My use case was in MSE, creating a SharedBuffer implies creating a FragmentedSharedBuffer and then a DataSegment that
implicitly creates a Vector<uint8_t> from a span<const uint8_t>. If you're copying 2.5MB, time is reduced to 33% of the
initial one.
* Source/WTF/wtf/Vector.h:
Canonical link: https://commits.webkit.org/300464@main1 parent 8774900 commit fa6096c
1 file changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
| |||
0 commit comments