Why is D's GC slower than GO's?
IGotD-
nise at nise.com
Sun Oct 30 11:04:42 UTC 2022
On Sunday, 30 October 2022 at 07:52:09 UTC, Ola Fosheim Grøstad
wrote:
>
> (Swift and Go are usually not considered system level.)
Swift is an interesting example of a possible system level
language, but you have to trip lightly in order not to get heap
allocations under the hood. Structs (which are value types) can
end up on the heap when you use protocols together with structs.
If you start to copy these heap allocated structs, you will
quickly start to do heap allocations under the hood.
This video gives a little explanation about.
https://developer.apple.com/videos/play/wwdc2016/416/
If pay attention you should be able to avoid these.
With multithreaded system services, Swift seems to be a very good
alternative. Atomic reference counting is here very suitable.
Also lately there have been a lot of work on the concurrent model
for Swift and it supports async/await, concurrent actors.
For the most low level programming Swift isn't an alternative but
for system services inside an existing OS there should Swift do
fine. Also, Swift seems to be a good fit for game programming as
well.
More information about the Digitalmars-d
mailing list