Skip to content
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

Breaking: Switch to BSON for storage #48

Merged
merged 9 commits into from
May 25, 2022
Merged

Breaking: Switch to BSON for storage #48

merged 9 commits into from
May 25, 2022

Conversation

awadell1
Copy link
Owner

While implementing load_benchmarks(:latest) it became apparent that stringifying everything before saving wasn't ideal (#45, #46, #43), and attempting to invert stringifying (35ed40a) started to balloon (Adding support for judge was getting hacky). So instead I've decided to switch to a serializer that wouldn't stringify everything.

  • Serialization.serialize - Smallest file size of all methods. But lacks stability (by design) across versions and machines. While benchmarking results tend to lose value quickly, I do want to support judging between versions / across machines.
  • JLD2 - Large file size, even when compressed
  • JLD - Would add a dependency on HDF5, large file size, and slow
  • JSON - Stringifies most data, mangling the keys for benchmark groups.
Serializer File Size [kB] Save Time
JSON 1.1 480 μs
Serialization 1.2 130 μs
BSON 1.8 1 ms
JLD2 3.8 670 μs
JLD 5.1 6 ms

File Size are the saving the benchmarks of test/Example.jl. Save Time is the rounded min time to save a results dict without compression.

Backwards compatibility

PkgJogger v0.4 and later will save results using BSON to *.bson.gz files. Loading results with load_benchmarks from *.json.gz files is supported by PkgJogger v0.4, but will be removed in a future release.

Other Changes

This PR also adds support for JogExample.load_benchmarks(:lastest) and JogExample.load_benchmarks(:oldest) to load the most recent / oldest results from disk. The :latest and :oldest identifiers are supported by judge and tune! as well.

Moved most of the `load_benchmarks` logic out of the Jogger and
into the main package.

Added dispatching for `:latest` and `:oldest` for loading results based
on the mtime of the results.

Added additional test cases to checkout loading benchmarks with :latest
Added test to check that Example.jl/benchmark/trial is deleted
Added `cleanup_example()` helper for cleaning up post test
Fixed `:latest` / `:oldest` tests to cleanup Example.jl prior to testing
Redefined a few lines down and the later def is cleaner
Previously, a key of `["bench_foo.jl", 0.1]` would be saved as ``["bench_foo.jl", "0.1"]`
and thus not match when checked with `setdiff` / `intersect`

Now checks for a unique serialization of keys, and then match on those keys
iff there is an injective (1:1) mapping. Keys that are not injective (1:n),
are always retuned, but realistically why would you have them?

Fixes #43
Remove tune! methods and use `_get_benchmarks` for more inputs
Instead of copying use `BenchmarkTools.loadparams!` for an inplace copy

Now throw error if given a refereance dict that's missing benchmarking results
BSON correctly seralizes data without stringifying it, which fixes the following seralization errors:
- `Jogger.judge(:latest, UUID)` fails #45
- `save_benchmarks` modifies types #43

Maintain backwards compatablity (ie loading old results), but
fully depreciate the old format
- Won't fix `save_benchmarks` modifies types #43 or `Jogger.judge(:latest, UUID)` fails #45 for `*.json.gz` files
- New features build on non-stringified results may not work
@awadell1 awadell1 merged commit 0c73ba6 into main May 25, 2022
@awadell1 awadell1 deleted the tui branch May 25, 2022 22:56
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.

1 participant