Mirror of
forum.nim-lang.org
index
4234 :: setLen without 0-initialization (for efficiency)
[2018-09-24T19:36:33+02:00]
View Orginal
timothee
(orginal)
[2018-09-24T19:36:33+02:00]
view original
Is it currently possible to call seq setLen without 0-initialization (for efficiency)? newSeqOfCap is not applicable since I want to reuse a buffer if not, should we add an overload for setLen?
mratsim
(orginal)
[2018-09-25T17:06:06+02:00]
view original
If the new length doesn't grow past the current capacity it doesn't 0-init.
No way otherwise AFAIK.
Araq
(orginal)
[2018-09-25T20:52:15+02:00]
view original
It is not possible.
timothee
(orginal)
[2018-09-26T13:44:06+02:00]
view original
PR's accepted?
cblake
(orginal)
[2018-09-26T18:18:32+02:00]
view original
+1 on the feature. I also sometimes re-use buffers that would benefit from this.