guides icon indicating copy to clipboard operation
guides copied to clipboard

swift high performance guide added

Open shilpeegupta14 opened this issue 3 years ago • 5 comments

High Performance in Swift guide added

Motivation

Contributing to the repository.

Description:

Overview of the readme file:

  1. Class vs Struct tradeoff and Copy-on-Write i)difference btw memory allocations ii)copy-on-write iii)benchmarking structs with classes iv)implementing structs backed by classes v) implementing structs backed by classes with copy on write

  2. Concurrency and Locking i) Thread explosion ii) runtime contract iii) serial queue and concurrent queue iv) Synchronization offering: 1. Mutual Exclusion 2. Reentrancy and Prioritization 3. Main Actor vii) Batching up code to improve time complexity viii) Lock Contention Pattern

References:

https://www.youtube.com/watch?v=iLDldae64xE https://www.youtube.com/watch?v=WCUj581Dpec https://developer.apple.com/videos/play/wwdc2021/10254/

Result:

Resolves: guide for writing high performance systems in swift

shilpeegupta14 avatar Jan 17 '22 14:01 shilpeegupta14

if there are any additions or deletions in my pr. Let me know!

shilpeegupta14 avatar Jan 25 '22 12:01 shilpeegupta14

thanks @shilpeegupta14 will take a look shortly

tomerd avatar Jan 25 '22 18:01 tomerd

thanks or putting this together @shilpeegupta14

since this seems to be summarizing existing resources on the internet, how about we change the PR to be an "index for talks about performance in Swift"? this way we can add more links as we have more resources instead of repeating them. wdyt?

tomerd avatar Feb 03 '22 02:02 tomerd

@tomerd thanks for taking out time to review this guide.

I am comfortable with the idea of changing the name of the pr and adding more resources. Some topics that I thought to write but wasn't sure if that comes in "high performance". Would like to know if I should add this or not:

  1. copy on write on indices and on arrays, dictionaries.
  2. operation queue vs gcd

topics/parts that I totally missed but will add:

  1. how dispatch semaphore can handle race conditions. tradeoffs of dispatch semaphore and how they can lead to priority inversion and deadlocks.
  2. how actors handle data races
  3. async/await performance

If there are anymore resources to add, let me know. If I get any related one to performance in swift, I will add up on this.

shilpeegupta14 avatar Feb 03 '22 10:02 shilpeegupta14

@tomerd The pr shifted to https://github.com/swift-server/guides/pull/80 Sorry for the inconvenience

shilpeegupta14 avatar Feb 09 '22 12:02 shilpeegupta14