Skip to content

Conversation

crtschin
Copy link

Some small refactors I did while sketching out something similar to #18. No changes in the API have been made, and there should be no observable changes in usage, except we are now also logging the maximum batch size that was possible on each iteration.

See the CHANGELOG.md for the full list of changes.

@crtschin crtschin force-pushed the crts/small-cleanup branch from 5076d8c to fb93e0a Compare August 21, 2025 08:27
@crtschin crtschin requested a review from arybczak September 3, 2025 11:05
@arybczak
Copy link
Collaborator

Did you check these INLINEABLE pragmas do what they're supposed to?

@crtschin
Copy link
Author

Did you check these INLINEABLE pragmas do what they're supposed to?

Did just now against the example target in the cabal file. Comparing core, it expectedly increases the amount of core generated and it generated specializations of [runConsumerWithMaybeIdleSignal, spawnMonitor, spawnDispatcher, updateJobsQuery, forkImpl, catches], where the m is fully specialized to (DBT_ (LogT IO) (LogT IO)).

For threads where the idea is that they run continuously in the background, my intuition is that it would be better to have them be concrete instead of carrying around instance dictionaries (and so GHC can also optimize more aggressively), in exchange for slightly longer compile-time (timed it and it resulted in a 7% increase (5.21s vs 5.58s)). Curious what you think though, it's not like this is a performance focused library, so it doesn't really matter, but it also doesn't hurt.

# Core was dumped with ` -ddump-simpl -dsuppress-all -ddump-to-file`

❯ wc -l /tmp/consumers-after.simpl
4882 /tmp/consumers-after.simpl

❯ wc -l /tmp/consumers-before.simpl
904 /tmp/consumers-before.simpl

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.

2 participants