AsyncSequence & AsyncStream Tutorial for iOS | raywenderlich.com

Learn how to use Swift concurrency’s AsyncSequence and AsyncStream protocols to process asynchronous sequences.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/34044359-asyncsequence-asyncstream-tutorial-for-ios

Several questions.

  1. When I’m running on my 2018 Intel MBP, the sync reads take 11.1 seconds and 1.93 GB. I’m guessing I’m on an older machine and the memory is a rounding error. Yours settled around 68.3 MB where mine was about 26.6 MB. Can’t explain that with an older machine.
  2. When I went to async, you dropped to 2.3 seconds but mine skyrocketed to 53.1 seconds for the duration. My memory dropped to 25.9 MB vs yours staying at 68.3 Any ideas why? Same rounding error for the storage?
  3. You also semi-silently switched from .onAppear to .task with essentially the same code. I tried to add the .readAsync to .onAppear and a compile error was thrown. Granted I’m on Xcode 14.
  4. When I added the getActors, my view being loaded time is trivial (vs. the Duration to load being 53 seconds). Yes I’m still using the full data.tsv file.

Hi Edward, those are very interesting variations! I wrote the article on an M1, but I wouldn’t have expected it to be so different. I do have a 2018 MBP, so I’ll try running the project there when I get back to Melbourne, mid-Oct. Thanks for posting!

1 Like