Re:Go does not need a Java-style GC
by CyberDildonics on Tuesday November 23, 2021 @04:04PM
(#29323517)
I would never write something like this in java, but to be fair, a program shouldn't be written like this in the first place. If you "need" a billion strings in memory and you didn't design for that with something that would scale better, you messed up a long time ago.
[ Parent
| on HN ]
Re:Go does not need a Java-style GC
by marginalia_nu on Tuesday November 23, 2021 @04:17PM
(#29323668)
Huh, I didn't really have a problem solving the problem as it came up. Like many scaling problems, it wasn't a problem until it was. Then I fixed it. Now I have a solution that can deal with ten times as many strings as before. If I grow out of that one, I'll come up with a better design.
I could have gotten 10 times as much hardware instead, but that would be an incredible waste of money compared to just spending a few days writing more hardware-efficient code.
I have addressed similar problems using a typed array of contiguous memory and another array of lengths.
Re:Go does not need a Java-style GC
by marginalia_nu on Wednesday November 24, 2021 @03:30PM
(#29334759)
I did try exactly that, but the GC overhead was still prohibitively high for my use case, made because big arrays in practice are composed from shorter non-contiguous arrays to make garbage collection even remotely possible.