News for hackers. Stuff that matters.
Re:Go 1.20 Released by jen20 on Thursday February 02, 2023 @01:12AM (#34622784)
> I doubt this library is useful

It is.

> Additionally, it may slow down the resulting code.

FUD.

Re:Go 1.20 Released by valyala on Friday February 03, 2023 @02:23AM (#34638161)
Agreed, it's my fault that I didn't explain why maps.DeleteFunc() can be slower than a simple loop with "if" statement inside. The reasons for the slowdown are:

- Go compiler may fail to inline the callback passed to the maps.DeleteFunc(). This will result into an additional overhead for callback calls per each item in the map.

- Go compiler may move some variables inside the callback from stack to a heap. This will result in an additional memory allocations comparing to a simple loop, leading to an additional load on garbage collector.