Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Hack point to be a struct. #7
Brutal hack and no correctness checking done.
Don’t just merge this. PR is for showing code rather than immediate merging. I haven’t got the tests running and changing to a struct point type will have changed the semantics. It does however more than double the speed of the test on my iPhone 5 from about 28s to 13.5s on my iPhone 5 for 10000 runs.
If you want high performance in Swift then structs can really deliver and given more time I would have done a more extensive rewrite changing more of you classes into structs where it made sense. The code as it stands feels like a very direct translation that doesn't utilise the full strength of Swift and in particular structs.
C type structs would be fast but don't have as good syntactic sugar as in Swift and aren't so idiomatic for Objective-C. Once you have abandoned objects it is essentially just C but that probably is the typical approach when really performance critical code is required.