News for hackers. Stuff that matters.
Re:Go 1.21 by stefan_ on Wednesday June 21, 2023 @06:13PM (#36425408)
Clearing a container is usually a much simpler and faster operation than looping through all and removing them individually. That's not a question of tidying something up.
Re:Go 1.21 by onionisafruit on Wednesday June 21, 2023 @06:40PM (#36425670)
There were compiler optimizations for clearing by iterating. I haven’t looked at the code, but I suspect this won’t be much more efficient than iterating was with the optimizations.
Re:Go 1.21 by yencabulator on Wednesday June 21, 2023 @10:43PM (#36427419)
I expect both will result in the same code; the only difference is that the clear built-in can handle maps with NaN keys.