| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,36 @@ | |||
| 1 | + #!/usr/bin/env Rscript | ||
| 2 | + library(ggplot2); | ||
| 3 | + library(plyr); | ||
| 4 | + | ||
| 5 | + # get __dirname and load ./_cli.R | ||
| 6 | + args = commandArgs(trailingOnly = F); | ||
| 7 | + dirname = dirname(sub("--file=", "", args[grep("--file", args)])); | ||
| 8 | + source(paste0(dirname, '/_cli.R'), chdir=T); | ||
| 9 | + | ||
| 10 | + if (!is.null(args.options$help) || | ||
| 11 | + (!is.null(args.options$plot) && args.options$plot == TRUE)) { | ||
| 12 | + stop("usage: cat file.csv | Rscript bar.R | ||
| 13 | + --help show this message | ||
| 14 | + --plot filename save plot to filename"); | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + plot.filename = args.options$plot; | ||
| 18 | + | ||
| 19 | + dat = read.csv( | ||
| 20 | + file('stdin'), | ||
| 21 | + colClasses=c('character', 'character', 'character', 'numeric', 'numeric') | ||
| 22 | + ); | ||
| 23 | + dat = data.frame(dat); | ||
| 24 | + | ||
| 25 | + dat$nameTwoLines = paste0(dat$filename, '\n', dat$configuration); | ||
| 26 | + dat$name = paste0(dat$filename, ' ', dat$configuration); | ||
| 27 | + | ||
| 28 | + # Create a box plot | ||
| 29 | + if (!is.null(plot.filename)) { | ||
| 30 | + p = ggplot(data=dat, aes(x=nameTwoLines, y=rate, fill=binary)); | ||
| 31 | + p = p + geom_bar(stat="summary", position=position_dodge()); | ||
| 32 | + p = p + ylab("rate of operations (higher is better)"); | ||
| 33 | + p = p + xlab("benchmark"); | ||
| 34 | + p = p + theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5)); | ||
| 35 | + ggsave(plot.filename, p); | ||
| 36 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -293,7 +293,10 @@ module, you can use the `--filter` option:_ | |||
| 293 | 293 | ``` | |
| 294 | 294 | ||
| 295 | 295 | For analyzing the benchmark results, use [node-benchmark-compare][] or the R | |
| 296 | - script `benchmark/compare.R`. | ||
| 296 | + scripts: | ||
| 297 | + | ||
| 298 | + * `benchmark/compare.R` | ||
| 299 | + * `benchmark/bar.R` | ||
| 297 | 300 | ||
| 298 | 301 | ```console | |
| 299 | 302 | $ node-benchmark-compare compare-pr-5134.csv # or cat compare-pr-5134.csv | Rscript benchmark/compare.R | |
| Back | FazBrowse Home | New Git URL |
0 commit comments