Skip to content

Instantly share code, notes, and snippets.

@PeteHaitch
Last active August 11, 2017 14:28
Show Gist options
  • Save PeteHaitch/e6364c14d0c04d66a1b1db88fbcc7016 to your computer and use it in GitHub Desktop.
Save PeteHaitch/e6364c14d0c04d66a1b1db88fbcc7016 to your computer and use it in GitHub Desktop.
library(profmem)
library(Matrix)
dgt <- readMM("~/sparse.mtx.gz")
dgc <- as(dgt, "dgCMatrix")
threshold <- 5
# Total memory allocation (bytes)
total(profmem(Matrix::colSums(dgt > threshold)))
#> [1] 935422632
total(profmem(Matrix::colSums(dgc > threshold)))
#> [1] 787165392
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment