Skip to content

Instantly share code, notes, and snippets.

@maptracker
Created November 6, 2015 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maptracker/4e30bc5fa89105a2fb4e to your computer and use it in GitHub Desktop.
Save maptracker/4e30bc5fa89105a2fb4e to your computer and use it in GitHub Desktop.
Graphical benchmarks with #microbenchmark in #R
# Code to make random matrices:
source("https://gist.github.com/maptracker/07390983253758614ecc/raw/5995a7c1112420b64ff33dcb1e7dac679d05dbf9/randomMatrix.R")
library("microbenchmark")
library("ggplot2")
# Iterate 1000 times over solving three sizes of matrices
bench <- microbenchmark( "10x10" = solve( randomMatrix( 10 ) ),
"20x20" = solve( randomMatrix( 20 ) ),
"50x50" = solve( randomMatrix( 50 ) ),
times = 1000 )
# Plot results:
autoplot(bench)
# Taken from: https://stackoverflow.com/questions/24451575/what-does-autoplot-microbenchmark-actually-plot
@maptracker
Copy link
Author

Example output:
autoplot-microbenchmark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment