-
Notifications
You must be signed in to change notification settings - Fork 27
Reduce memory footprint of coord2ind #522
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
Open
jefferis
wants to merge
16
commits into
master
Choose a base branch
from
feature/efficient-coord2ind
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* and doesn't have to be coerced to one either
* for testing, provide arg to switch between new and original algorithm > bench::mark(coord2ind(m, testImage), coord2ind(m, testImage, use.scale = T), min_time = 3) # A tibble: 2 × 13 expression min median `itr/sec` mem_alloc `gc/sec` n_itr n_gc <bch:expr> <bch:> <bch:> <dbl> <bch:byt> <dbl> <int> <dbl> 1 coord2ind(m… 63.7ms 73.4ms 1.16106306906514e1 252MB 2.25577967704085e1 35 68 2 coord2ind(m… 56.3ms 62.8ms 1.39956214910579e1 206MB 2.13266613197073e1 42 64
> bench::mark(v1=coord2ind(mdf, testImage, version=1), v2=coord2ind(mdf, testImage, version=2), v3=coord2ind(mdf, testImage, version=3), min_time = 1) # A tibble: 3 × 13 expression min median `itr/sec` mem_alloc `gc/sec` n_itr n_gc total_time <bch:expr> <bch:t> <bch:> <dbl> <bch:byt> <dbl> <int> <dbl> <bch:tm> 1 v1 82.9ms 90.2ms 7.93571545940208e0 298MB 1.78553597836547e1 8 18 1.01s 2 v2 68.6ms 80ms 9.53099788536415e0 252MB 1.90619957707283e1 10 20 1.05s 3 v3 48.6ms 60.1ms 1.44604097192445e1 172MB 1.9280546292326 e1 15 20 1.04s # ℹ 4 more variables: result <list>, memory <list>, time <list>, gc <list>
* empirically t_tx_OP_y seems to be better than scale (benefit is more limited with data.frame input mind you)
* the final version is ~ 40x more memory efficient and 10x faster than the original implementation
* just a convenience for running tests interactively
CMake Error at CMakeLists.txt:38 (CMAKE_MINIMUM_REQUIRED): Compatibility with CMake < 3.5 has been removed from CMake. Update the VERSION argument <min> value. Or, use the <min>...<max> syntax to tell CMake that the project requires at least <min> but has been updated to work with policies introduced by <max> or earlier. Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
* with example and some additional checks
* and add matrixStats to imports
08eee54 to
beae426
Compare
* v0.2 is now merged to master
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
see also #521