https://github.com/dahong67/cachevariables.jl
Save outputs from (expensive) computations.
Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
3 of 7 committers (42.9%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.6%) to scientific vocabulary
Repository
Save outputs from (expensive) computations.
Basic Info
- Host: GitHub
- Owner: dahong67
- License: mit
- Language: Julia
- Default Branch: master
- Size: 43 KB
Statistics
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 1
- Releases: 0
Metadata Files
README.md
CacheVariables.jl
A lightweight way to save outputs from (expensive) computations.
Function form
The function form saves the output of running a function
and can be used with the do...end syntax.
julia
cache("test.bson") do
a = "a very time-consuming quantity to compute"
b = "a very long simulation to run"
return (; a = a, b = b)
end
The first time this runs,
it saves the output in a BSON file called test.bson.
Subsequent runs load the saved output from the file test.bson
rather than re-running the potentially time-consuming computations!
Especially handy for long simulations.
An example of the output:
```julia julia> using CacheVariables
julia> cache("test.bson") do a = "a very time-consuming quantity to compute" b = "a very long simulation to run" return (; a = a, b = b) end [ Info: Saving to test.bson (a = "a very time-consuming quantity to compute", b = "a very long simulation to run")
julia> cache("test.bson") do a = "a very time-consuming quantity to compute" b = "a very long simulation to run" return (; a = a, b = b) end [ Info: Loading from test.bson (a = "a very time-consuming quantity to compute", b = "a very long simulation to run") ```
Macro form
The macro form looks at the code to determine what variables to save.
julia
@cache "test.bson" begin
a = "a very time-consuming quantity to compute"
b = "a very long simulation to run"
100
end
The first time this block runs,
it identifies the variables a and b and saves them
(in addition to the final output 100 that is saved as ans)
in a BSON file called test.bson.
Subsequent runs load the saved values from the file test.bson
rather than re-running the potentially time-consuming computations!
Especially handy for long simulations.
An example of the output:
```julia julia> using CacheVariables
julia> @cache "test.bson" begin a = "a very time-consuming quantity to compute" b = "a very long simulation to run" 100 end ┌ Info: Saving to test.bson │ a └ b 100
julia> @cache "test.bson" begin a = "a very time-consuming quantity to compute" b = "a very long simulation to run" 100 end ┌ Info: Loading from test.bson │ a └ b 100 ```
An optional overwrite flag (default is false) at the end
tells the macro to always save,
even when a file with the given name already exists.
```julia julia> @cache "test.bson" begin a = "a very time-consuming quantity to compute" b = "a very long simulation to run" 100 end false ┌ Info: Loading from test.bson │ a └ b 100
julia> @cache "test.bson" begin a = "a very time-consuming quantity to compute" b = "a very long simulation to run" 100 end true ┌ Info: Overwriting test.bson │ a └ b 100 ```
See also a similar package: Memoization.jl
Caveat:
The variable name ans is used for storing the final output
(100 in the above examples),
so it is best to avoid using this as a variable name.
Owner
- Name: David Hong
- Login: dahong67
- Kind: user
- Location: Newark, DE
- Company: University of Delaware
- Website: https://dahong.gitlab.io
- Repositories: 7
- Profile: https://github.com/dahong67
Assistant Professor in ECE
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Committers
Last synced: over 3 years ago
All Time
- Total Commits: 56
- Total Committers: 7
- Avg Commits per committer: 8.0
- Development Distribution Score (DDS): 0.625
Top Committers
| Name | Commits | |
|---|---|---|
| David Hong | d****7@u****m | 21 |
| David Hong | d****7@w****u | 18 |
| David Hong | d****g@u****u | 8 |
| Jonas Kersulis | k****s@u****u | 5 |
| Páll Haraldsson | P****n@g****m | 2 |
| Julia TagBot | 5****t@u****m | 1 |
| Jonas Kersulis | k****s@u****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 5
- Total pull requests: 6
- Average time to close issues: 1 day
- Average time to close pull requests: about 23 hours
- Total issue authors: 3
- Total pull request authors: 4
- Average comments per issue: 1.4
- Average comments per pull request: 1.5
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- dahong67 (3)
- kersulis (1)
- JuliaTagBot (1)
Pull Request Authors
- dahong67 (3)
- PallHaraldsson (1)
- kersulis (1)
- JuliaTagBot (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
- Total downloads: unknown
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 5
juliahub.com: CacheVariables
Save outputs from (expensive) computations.
- Documentation: https://docs.juliahub.com/General/CacheVariables/stable/
- License: MIT
-
Latest release: 0.1.4
published over 4 years ago