Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d1f4331

Browse filesBrowse files
RafaelGSSruyadorno
authored andcommitted
benchmark: add bar.R
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: #47729 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
1 parent fbe89e6 commit d1f4331
Copy full SHA for d1f4331

File tree

Expand file treeCollapse file tree

2 files changed

+40
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+40
-1
lines changed
Open diff view settings
Collapse file

‎benchmark/bar.R‎

Copy file name to clipboard
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
}
Collapse file

‎doc/contributing/writing-and-running-benchmarks.md‎

Copy file name to clipboardExpand all lines: doc/contributing/writing-and-running-benchmarks.md
+4-1Lines changed: 4 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,10 @@ module, you can use the `--filter` option:_
293293
```
294294

295295
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`
297300

298301
```console
299302
$ node-benchmark-compare compare-pr-5134.csv # or cat compare-pr-5134.csv | Rscript benchmark/compare.R

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.