Skip to content

refactor: use standardized swift-async-algorithms #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

Austinpayne
Copy link

Adopts the more common (now-a-days) swift-async-algorithms for the simple async collection needs of this package. Helps adopt the standardized ecosystem where many other packages use swift-async-algorithms.

Adopts the more common (now-a-days) swift-async-algorithms for the simple
async collection needs of this package. Helps adopt the standardized
ecosystem where many other packages use swift-async-algorithms.
@Austinpayne
Copy link
Author

@NeedleInAJayStack

@NeedleInAJayStack NeedleInAJayStack self-requested a review February 16, 2025 01:38
@NeedleInAJayStack
Copy link
Member

NeedleInAJayStack commented Feb 16, 2025

I believe if you change this line from v3 to v4, that will resolve the 'Test on Linux' check:

uses: actions/upload-artifact@v3

Copy link
Member

@NeedleInAJayStack NeedleInAJayStack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @Austinpayne

Copy link
Member

@paulofaria paulofaria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for your contribution! 🙂

@Austinpayne
Copy link
Author

I believe if you change this line from v3 to v4, that will resolve the 'Test on Linux' check:

uses: actions/upload-artifact@v3

Sweet, thanks! Pushed up a change to upgrade to v4.

@ZirgVoice
Copy link
Contributor

You replaced concurrentMap, which works in parallel and can process all values in the array simultaneously, with map, which processes values sequentially. This will reduce the performance of the DataLoader.

@Austinpayne
Copy link
Author

Yeah, it's true the semantics are different. Feel free to close if this potential performance change is unacceptable. I don't see any benchmarks in this package so I don't have a good way to qualify this change.

@NeedleInAJayStack
Copy link
Member

I'm inclined to agree with @ZirgVoice. Batching works by slightly pausing execution to allow more load calls to get into the DataLoader's queue. This works because queue.append happens before any awaited operation, so concurrent load or loadManys can be combined. If instead we await on each load of a loadMany call, then those loads will not actually be batched to the backend.

I'm realizing that we ought to add a test that validates this functionality for loadMany though..

@Austinpayne
Copy link
Author

Sounds good, thanks for the feedback!

@Austinpayne Austinpayne closed this Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants