Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

swift high performance guide added #78

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

swift high performance guide added #78

wants to merge 3 commits into from

Conversation

shilpeegupta14
Copy link

@shilpeegupta14 shilpeegupta14 commented Jan 17, 2022

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

@ktoso ktoso requested a review from tomerd January 21, 2022 06:46
@shilpeegupta14
Copy link
Author

shilpeegupta14 commented Jan 25, 2022

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

@tomerd
Copy link
Contributor

tomerd commented Jan 25, 2022

thanks @shilpeegupta14 will take a look shortly

@shilpeegupta14 shilpeegupta14 marked this pull request as draft January 28, 2022 07:56
@tomerd
Copy link
Contributor

tomerd commented Feb 3, 2022

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?

@shilpeegupta14
Copy link
Author

shilpeegupta14 commented Feb 3, 2022

@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
Copy link
Author

@tomerd
The pr shifted to #80
Sorry for the inconvenience

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants