ResumableFunctions

ResumableFunctions: C# sharp style generators for Julia. - Published in JOSS (2017)

https://github.com/JuliaDynamics/ResumableFunctions.jl

Science Score: 46.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
    2 of 20 committers (10.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.0%) to scientific vocabulary

Keywords

finite-state-machine iterator julia semi-coroutine stackless

Keywords from Contributors

graphics optim optimisation unconstrained-optimisation simulations unconstrained-optimization physics fluxes polynomials energy-systems
Last synced: 6 months ago · JSON representation

Repository

C# style generators a.k.a. semi-coroutines for Julia.

Basic Info
  • Host: GitHub
  • Owner: JuliaDynamics
  • License: other
  • Language: Julia
  • Default Branch: master
  • Homepage:
  • Size: 1.41 MB
Statistics
  • Stars: 165
  • Watchers: 11
  • Forks: 23
  • Open Issues: 11
  • Releases: 38
Topics
finite-state-machine iterator julia semi-coroutine stackless
Created over 8 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License

README.md

ResumableFunctions

Documentation Documentation of latest stable version Documentation of dev version
Continuous integration GitHub Workflow Status
Code coverage Test coverage from codecov
Static analysis with JET static analysis Aqua QA

status DOI

C# has a convenient way to create iterators using the yield return statement. The package ResumableFunctions provides the same functionality for the Julia language by introducing the @resumable and the @yield macros. These macros can be used to replace the Task switching functions produce and consume which were deprecated in Julia v0.6. Channels are the preferred way for inter-task communication in julia v0.6+, but their performance is subpar for iterator applications. See the benchmarks section below.

Installation

ResumableFunctions is a registered package and can be installed by running: julia using Pkg Pkg.add("ResumableFunctions")

Example

```julia using ResumableFunctions

@resumable function fibonacci(n::Int) :: Int a = 0 b = 1 for i in 1:n @yield a a, b = b, a+b end end

for fib in fibonacci(10) println(fib) end ```

```julia

Example which specifies the length

using ResumableFunctions

@resumable length=n^2 function fibonacci(n::Int) :: Int a = 0 b = 1 for i in 1:n^2 @yield a a, b = b, a+b end end

for fib in fibonacci(5) println(fib) end ```

Benchmarks

The following block is the result of running julia --project=. benchmark/benchmarks.jl on a Macbook Pro with following processor: Intel Core i9 2.4 GHz 8-Core. Julia version 1.5.3 was used.

Fibonacci with Int values:

Direct: 27.184 ns (0 allocations: 0 bytes) ResumableFunctions: 27.503 ns (0 allocations: 0 bytes) Channels csize=0: 2.438 ms (101 allocations: 3.08 KiB) Channels csize=1: 2.546 ms (23 allocations: 1.88 KiB) Channels csize=20: 138.681 μs (26 allocations: 2.36 KiB) Channels csize=100: 35.071 μs (28 allocations: 3.95 KiB) Task scheduling 17.726 μs (86 allocations: 3.31 KiB) Closure: 1.948 μs (82 allocations: 1.28 KiB) Closure optimised: 25.910 ns (0 allocations: 0 bytes) Closure statemachine: 28.048 ns (0 allocations: 0 bytes) Iteration protocol: 41.143 ns (0 allocations: 0 bytes)

Fibonacci with BigInt values:

Direct: 5.747 μs (188 allocations: 4.39 KiB) ResumableFunctions: 5.984 μs (191 allocations: 4.50 KiB) Channels csize=0: 2.508 ms (306 allocations: 7.75 KiB) Channels csize=1: 2.629 ms (306 allocations: 7.77 KiB) Channels csize=20: 150.274 μs (309 allocations: 8.25 KiB) Channels csize=100: 44.592 μs (311 allocations: 9.84 KiB) Task scheduling 24.802 μs (198 allocations: 6.61 KiB) Closure: 7.064 μs (192 allocations: 4.47 KiB) Closure optimised: 5.809 μs (190 allocations: 4.44 KiB) Closure statemachine: 5.826 μs (190 allocations: 4.44 KiB) Iteration protocol: 5.822 μs (190 allocations: 4.44 KiB)

Authors

Contributing

  • To discuss problems or feature requests, file an issue. For bugs, please include as much information as possible, including operating system, julia version, and version of MacroTools.
  • To contribute, make a pull request. Contributions should include tests for any new features/bug fixes.

Release Notes

A detailed change log is kept.

Caveats

  • In a try block only top level @yield statements are allowed.
  • In a finally block a @yield statement is not allowed.
  • An anonymous function can not contain a @yield statement.
  • @isdefined can not be used in a resumable function.
  • Many more restrictions.

Owner

  • Name: JuliaDynamics
  • Login: JuliaDynamics
  • Kind: organization

A Julia-based software organization for dynamical systems, nonlinear dynamics, complex systems and the complexities of the scientific life

GitHub Events

Total
  • Fork event: 2
  • Create event: 12
  • Commit comment event: 9
  • Release event: 4
  • Issues event: 17
  • Watch event: 6
  • Delete event: 11
  • Member event: 1
  • Issue comment event: 68
  • Push event: 38
  • Pull request event: 38
  • Pull request review event: 3
  • Pull request review comment event: 3
Last Year
  • Fork event: 2
  • Create event: 12
  • Commit comment event: 9
  • Release event: 4
  • Issues event: 17
  • Watch event: 6
  • Delete event: 11
  • Member event: 1
  • Issue comment event: 68
  • Push event: 38
  • Pull request event: 38
  • Pull request review event: 3
  • Pull request review comment event: 3

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 265
  • Total Committers: 20
  • Avg Commits per committer: 13.25
  • Development Distribution Score (DDS): 0.294
Past Year
  • Commits: 18
  • Committers: 4
  • Avg Commits per committer: 4.5
  • Development Distribution Score (DDS): 0.5
Top Committers
Name Email Commits
Ben Lauwens b****s@g****m 187
Stefan Krastanov s****n@k****g 36
dependabot[bot] 4****] 16
Ben Lauwens b****n@B****l 3
Gabriel Gerlero g****o 3
Luca Di Gaspero l****o@u****t 2
Adam Beckmeyer a****g@t****z 2
Arfon Smith a****n 2
Tommy Hofmann t****a@g****m 2
femtocleaner[bot] f****] 2
Jim Garrison j****m@g****c 1
Gabriel Baraldi b****l@g****m 1
Fredrik Ekre f****e@c****e 1
Julia TagBot 5****t 1
Keno Fischer k****o@a****u 1
Morten Piibeleht m****t@g****m 1
Noé Rubinstein n****n@g****m 1
Pepijn de Vos p****s@g****m 1
ggggggggg g****l@g****m 1
scls19fr s****r 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 24
  • Total pull requests: 48
  • Average time to close issues: about 1 year
  • Average time to close pull requests: 11 days
  • Total issue authors: 15
  • Total pull request authors: 8
  • Average comments per issue: 3.63
  • Average comments per pull request: 2.81
  • Merged pull requests: 40
  • Bot issues: 0
  • Bot pull requests: 18
Past Year
  • Issues: 8
  • Pull requests: 25
  • Average time to close issues: 26 days
  • Average time to close pull requests: 4 days
  • Issue authors: 7
  • Pull request authors: 4
  • Average comments per issue: 2.88
  • Average comments per pull request: 1.56
  • Merged pull requests: 18
  • Bot issues: 0
  • Bot pull requests: 9
Top Authors
Issue Authors
  • Krastanov (10)
  • MarkNahabedian (2)
  • lgoettgens (1)
  • goretkin (1)
  • ahjulstad (1)
  • hdavid16 (1)
  • filchristou (1)
  • marcom (1)
  • gbaraldi (1)
  • marc-hofmann (1)
  • gerlero (1)
  • JuliaTagBot (1)
  • brianguenter (1)
  • baggepinnen (1)
Pull Request Authors
  • Krastanov (30)
  • dependabot[bot] (26)
  • thofma (5)
  • digital-carver (4)
  • gerlero (3)
  • Keno (2)
  • gbaraldi (2)
  • pepijndevos (1)
Top Labels
Issue Labels
edge case syntax (4) enhancement (2) bug bounty (1) bounty:600 (1) error messages (1) good first issue (1)
Pull Request Labels
dependencies (25) Skip-Changelog (4) github_actions (4)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 102 total
  • Total dependent packages: 14
  • Total dependent repositories: 3
  • Total versions: 25
juliahub.com: ResumableFunctions

C# style generators a.k.a. semi-coroutines for Julia.

  • Versions: 25
  • Dependent Packages: 14
  • Dependent Repositories: 3
  • Downloads: 102 Total
Rankings
Stargazers count: 5.0%
Dependent packages count: 5.3%
Average: 6.5%
Dependent repos count: 6.9%
Forks count: 8.7%
Last synced: 6 months ago

Dependencies

.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/ci.yml actions
  • actions/cache v1 composite
  • actions/checkout v2 composite
  • codecov/codecov-action v1 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/CompatHelper.yml actions
.github/workflows/benchmark-comment.yml actions
  • actions/checkout v4 composite
  • dawidd6/action-download-artifact v3 composite
  • peter-evans/create-or-update-comment v3 composite
  • peter-evans/find-comment v2 composite
.github/workflows/benchmark.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • julia-actions/julia-buildpkg latest composite
  • julia-actions/setup-julia latest composite
.github/workflows/ci-julia-nightly.yml actions
  • actions/cache v3 composite
  • actions/checkout v4 composite
  • codecov/codecov-action v3 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest v1 composite
  • julia-actions/setup-julia v1 composite
.github/workflows/invalidations.yml actions
  • actions/checkout v4 composite
  • julia-actions/julia-buildpkg v1 composite
  • julia-actions/julia-invalidations v1 composite
  • julia-actions/setup-julia v1 composite