Test and benchmark for block_data SDP serialization (JSON/binary) #119
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
block_data
serialization tounit tests
.DIFF
functions used in both unit and integration tests.block_data_serialization.test
writes block_data (constraint matrixB
, constraint vectorc
and blilinear bases) to stringstream and then reads them back.On my laptop, the benchmarking results are kind of unstable, but generally show ~20x-30x speedup for binary format compared to JSON (see #79).
Note that in real applications the expected bottlneck is disk IO, so one can expect up to ~2.4x speedup.
I observed such numbers for writing sdp in small end-to-end tests, but they should be taken with a grain of salt. I haven't benchmarked any big problem.
Note that, by default, Catch2 framework does not run test cases marked by
[!benchmark]
To run benchmark, run unit_tests as follows:
Catch2 by default uses 100 samples (i.e. runs each benchmark 100 times) and prints detailed statistics.
For a simple and fast output, you can run, e.g.,
More information on Catch2 benchmarks and command-line options:
https://github.com/catchorg/Catch2/blob/devel/docs/benchmarks.md
https://github.com/catchorg/Catch2/blob/devel/docs/command-line.md