5 ms·
Yes, we could write most of the critical part in C and it would probably be faster. But then it wouldn't be a Swift driver.
by emmericp 7y ago
Yes, we could write most of the critical part in C and it would probably be faster. But then it wouldn't be a Swift driver.
- skohan 7y agoAre these benchmarks single-threaded? I took a brief look at the Swift codebase, and I noticed that you are using semaphores, but there doesn't seem to be any parallel execution anywhere in the project.
- emmericp 7y agoThe Semaphore is only used during initialization, never in the critical path, see profiling results in the main repo
- jmull 7y agoI don't think you need to write the critical part of the driver in C to speed up the swift implementation. I clicked through to a performance analysis showing ARC taking about 3/4 the time (in the release build). You don't really need to be doing a lot of ARC in the inner loops if you don't want to.
- emmericp 7y agoYes, we do if we want to have an idiomatic interface for the application on top of the driver. Pull requests proving otherwise are welcome
- jmull 7y agoI don’t think it’s idiomatic to do a bunch of unnecessary memory management in inner loops, right?
- mpweiher 7y agoThe memory management is being done by the language.
- jmull 7y agoARC is implemented at the language level but it's not required. You can use it when and where you like. One fundamental aspect of swift is the distinction between reference types -- which are reference counted -- and value types -- which are not. Generally in Swift you'd use a value type over a reference type unless you have reasons not to. E.g.: https://developer.apple.com/documentation/swift/choosing_between_structures_and_classes https://developer.apple.com/documentation/swift/choosing_bet... I mean, I don't know what the right approach for this library is. The authors are going to have to fix their own code. IMO, coming up with a demonstrably poor solution and trying to defend it as "idiomatic" is pretty weak.
- dep_b 7y agoWell if the C# and Java implementations use C they're definitely not C# and Java drivers. But you don't need to use C directly, just use the C features that are supported by Swift itself.
- EpicEng 7y agoC isn't in the critical path of either of those two implementations. GP is saying that it would be in a Swift version. Whether or not that's accurate I have no idea.