Skip to content

Commit c31ad0d

Browse files
committed
🚧 plot.R: visualizations
1 parent 60d5af4 commit c31ad0d

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

‎plot.R

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env Rscript
2+
3+
# 20231030WF - init
4+
# read in hyperfine stats for each language. files generted by Makefile
5+
library(dplyr); library(tidyr); library(ggplot2)
6+
benchmarks <-
7+
Sys.glob('out/*/*.csv') |>
8+
lapply(\(f) tryCatch(read.csv(f) %>%
9+
mutate(f=gsub('out/|-stats.csv','',f)),
10+
error=\(e) NULL)) |>
11+
bind_rows()
12+
13+
bclean <- benchmarks |>
14+
separate(f,c('proc','host','app'),sep='[-/]') |>
15+
mutate(impl=gsub(' .*|scripts/','',command) %>%
16+
gsub('.*\\.','',.),
17+
proc=gsub('_+', ' ', proc)) |>
18+
filter(!grepl('target/',impl))
19+
20+
brank <- bclean |>
21+
group_by(proc,host,app) |>
22+
mutate(r=rank(`mean`))
23+
24+
ggplot(brank) +
25+
aes(x=impl, y=`r`,
26+
color=stringr::str_wrap(proc,20),
27+
label=round(`mean`,2)) +
28+
geom_point() +
29+
geom_text(size=2, vjust=1, hjust=-.25, color='black',aes(color=NULL)) +
30+
facet_wrap(~app, scales="free_x") +
31+
cowplot::theme_cowplot() +
32+
labs(title='Preformace Rank per Implementations (lower better)',
33+
x='Implementation', y='Rank', color="Processor")+
34+
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust=0),
35+
legend.position='top')
36+
ggsave('out/rank_plot.png',width=10.6,height=6)

0 commit comments

Comments
 (0)