Porting a Toy Path Tracer to Swift
I ported a toy path tracer to Swift. Some performance numbers: Colab, effectively single threaded: 3 Mrays/s iPhone 11 Pro Max: 18 Mrays/s iPad Pro 12.9" 2018: 21 Mrays/s iMac Pro 2017 18-core: 96 Mrays/s The hardest part of the port was reducing contention between threads. I had to replicate the tracing object (which contains the scene data) per thread in order to avoid serializing on ARC retain/release code. Swift currently has no way to share an immutable object graph across multiple threads without incurring ARC overhead every time any object in that graph is accessed. Perhaps when Swift implements some form of the Ownership Manifesto this will be fixed.