Skip to content

Conversation

@vtjnash
Copy link
Collaborator

@vtjnash vtjnash commented Jan 13, 2026

This simplifies the generated function to avoid the runtime edge against
the method (instead passing that as an explicit argument to the
generator), and then fixes the calls into the Compiler module to
correctly forward the world information back through the generator.

This simplifies the generated function to avoid the runtime edge against
the method (instead passing that as an explicit argument to the
generator), and then fixes the calls into the Compiler module to
correctly forward the world information back through the generator.
Comment on lines 80 to +87
# get typed code
codeinfos = Core.eval(mod, code_typed(inferfn, Tuple; optimize=false))
m = only(methods(inferfn, Tuple))
codeinfo = only(code_typed(inferfn, Tuple; optimize=false))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Something to consider after this PR: this pre-work analysis here is invalid now that binding replacement is possible. Does it provide any useful result, or can this just be deleted (along with all of the associated complexity it causes)?

Copy link
Member

Choose a reason for hiding this comment

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

Supposedly much of this complexity was necessary for the generated coroutine to be fast. Without all of this, the generated structure representing the finite state machine did not have its fields concretely typed, leading to a ton of boxing and allocations.

Or maybe I am completely misunderstanding. Regrettably, currently I am the only "maintainer", but I myself am not particularly knowledgeable of the compiler internals that this package depends on. Maybe more of a "care taker" than a "maintainer".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Gotcha. Yeah, I did some git splunking and it appears that this should have been removed in #76, but apparently got left behind as detritus of the original design limitations. I'll take that as license to clean this up more.

I am interested in helping maintain this, particularly as an example project of how to use the compiler internals well. I have some ideas in mind for more drastic improvements.

@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2026

Codecov Report

❌ Patch coverage is 93.10345% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.86%. Comparing base (b230aef) to head (af357f8).

Files with missing lines Patch % Lines
src/macro.jl 76.92% 3 Missing ⚠️
src/utils.jl 97.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #147      +/-   ##
==========================================
+ Coverage   79.55%   80.86%   +1.31%     
==========================================
  Files           6        6              
  Lines         680      690      +10     
==========================================
+ Hits          541      558      +17     
+ Misses        139      132       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Krastanov
Copy link
Member

@vtjnash , it seems most dependencies of ResumableFunctions were still working fine on 1.12. Could you let me know how you were made aware of these problems? That would help me in making sure the tests are actually not missing anything.

@vtjnash
Copy link
Collaborator Author

vtjnash commented Jan 14, 2026

It might be v1.13 then, since I'm not actually good at remembering which version we are on. It has been failing in PkgEval for some time:
https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_date/2025-12/11/report.html
https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_date/2025-12/11/ResumableFunctions.primary.log

@Krastanov
Copy link
Member

I am interested in helping maintain this, particularly as an example project of how to use the compiler internals well. I have some ideas in mind for more drastic improvements.

That would be greatly beneficial in many ways. (1) I personally am searching for good onboarding materials to learn more about the compiler. (2) Having one of the few deep julia wizards vet the quality of this package would make me much more comfortable basing production code on top of ResumableFunctions.

I will go ahead and add you the package owners so that you can more freely make changes to this repository.

While I very much like the idea of code reviews, this package currently does not have deeply knowledgeable maintainers, and you have pretty significant credentials, so do not hesitate to merge your PRs without waiting for review, as long as the downstream tests (especially ConcurrentSim.jl) pass. On the other hand, please keep updating the changelog as you make changes -- otherwise I would truly be out of my depth when you move on to your next pet project.

FYI, if you find this useful, I consent to bumping the compat to julia 1.12. And mildly-breaking releases are not out of the question -- the package does not have that many dependents and I can commit to submitting PRs to them if changes happen.

Lastly, the benchmarks.jl script is reasonably representative of simple tasks that have been difficult to keep properly inferred / fast as the library has evolved.

@vtjnash
Copy link
Collaborator Author

vtjnash commented Jan 14, 2026

Thanks! That is good to know. I hope to keep things compatible (with optional flags to opt in for new behaviors and fixes), but perhaps that means we'll eventually drop old implementations if there aren't any users who end up needing them

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.

3 participants