swift-server / guides

Guides for building, debugging and deploying Swift Server applications
258 stars 21 forks source link

index of talks about performance in Swift guide added #80

Open shilpeegupta14 opened 2 years ago

shilpeegupta14 commented 2 years ago

High Performance in Swift guide added

Motivation

Contributing to the repository.

Description:

Overview of the readme file:

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 vi) Drawbacks of CoW

Concurrency and Locking

i) Race Condition with Semaphores ii) Priority inversion with Semaphores iii) Thread explosion iv) Runtime contract and rewriting code with async/await semantics for better performance of the code. iv) Synchronization offering:

  1. Mutual Exclusion This covers: i) Actors with data races when we are accessing the mutable states within the actors ii) Actors with data races when we are accessing the mutable states outside the actors and fixing it with sendable protocols
  2. Reentrancy and Prioritization This covers actors with Priority Inversion
  3. Main Actor Batching up code to improve time complexity and performance

v) Potential bug around await semantics vi) Other primitives and 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/ https://developer.apple.com/videos/play/wwdc2021/10133/

Result:

Resolves: #64 guide for writing high performance systems in swift

tomerd commented 2 years ago

task again for the PR @shilpeegupta14

circling back to the feedback on #78: iiuc correctly this content mostly summarizes talks available publicly, which is what is pointed out in the "references" section above. if this is true, perhaps we can -restructure the suggested content around talks rather then as a "performance guide"? i.e

  1. have an index page with a list of talks, having each entry link to the the talk recording and the summary (item 2)
  2. have page summarizing the key take away from the talk, one page per talk
shilpeegupta14 commented 2 years ago

@tomerd The update pr #80 contains some additions that are not part of any WWDC talk and were not added previously in #78. Such topics are: drawbacks of COW Race Condition and Priority Inversion with Semaphores Accessing mutable state outside the actor

Also, some topics like main Actor, mutual exclusion, reentrancy and prioritisation are talked about in both the WWDC talks. https://developer.apple.com/videos/play/wwdc2021/10254/ https://developer.apple.com/videos/play/wwdc2021/10133/

Summarising them talk wise will scatter information in many parts and might cause repetition.