2 ms·
Thanks for the links, though I'm unsure what the second link is for. I hope my assessment is 'fair.' I used to feel more strongly than I do now, I guess. It'
by axaxs 6y ago
Thanks for the links, though I'm unsure what the second link is for.
I hope my assessment is 'fair.' I used to feel more strongly than I do now, I guess.
It's a weird situation. The rules say 'dont write your own memory pools', but new languages wouldn't have a popular library available. Seems it should be 'dont use them at all', or allow them for all. This puts any new language at an immediate disadvantage.
Anyhow, thanks for keeping it going so long. Fun little site.
- igouy 6y agoIn this case, the new language Go had GC available.
- axaxs 6y agoC has malloc and free available, even when it was new.
- igouy 6y agoNon sequitur? "Go was born out of frustration with existing languages … To meet these goals required addressing a number of linguistic issues: an expressive but lightweight type system; concurrency and garbage collection …" https://golang.org/doc/faq#creating_a_new_language https://golang.org/doc/faq#creating_a_new_language https://golang.org/doc/faq#garbage_collection https://golang.org/doc/faq#garbage_collection Seems like you wished not to show one of Go's big features?
- simpleguitar 6y agoWhy can't GC coexist with memory pools? They both have good uses. It's pretty clear that Go designers wanted a GC, but also wanted control over memory. In go, it is trivial to create a slice of structs that's contiguous in memory, and built-ins like 'copy' means the language designers wanted users to use this feature. When I write go, GC is used almost always. Except when it becomes a bottleneck, at which point I trivially switch to memory pools. I just add a comment like "preallocate to avoid allocating in a loop", and move on. The next person that comes by my code would have no trouble understanding what happened there--unlike Java where using memory pools stops looking like Java. I think when the Go FAQ mentions existing pain points, it means both GC'ed and Non-GC'ed languages. Zig is cool because it went the manual layout route, but with a pluggable allocator. I think it's a brilliant choice, especially for embedded.
- igouy 6y agoThere seem to be plenty of Sync.Pool blog posts, but only a sequential Sync.Pool binary-trees program that I transliterated.
- igouy 6y agoPerhaps this is the example of what you meant — Sync.Pool was not available until go1.3 (June 2014).