-
Notifications
You must be signed in to change notification settings - Fork 0
/
histo.R
executable file
·68 lines (58 loc) · 2.12 KB
/
histo.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env Rscript
library("ggplot2")
library("dplyr")
library("stringr")
files <- list.files(path = "out/", pattern = "histo*")
data <- lapply(
files,
function(x) {
read.csv(
paste0("out/", x),
header = FALSE,
col.names = c("bin", "input", "size", "machine", "date", "time"))
})
data <- do.call("rbind", data)
data <- data %>%
filter(size >= 2 ** 19) %>%
filter(size < 2 ** 29) %>%
mutate(
time = as.numeric(time),
implementation = as.vector(str_match(bin, "[^/]*(?=/[^/]*$)")),
compiler = as.vector(str_match(bin, "[^/]*(?=/[^/]*/[^/]*$)")),
version = as.vector(str_match(bin, "[^/]*$")))
for (m in unique(data$machine)) {
on_machine <- data %>% filter(as.vector(machine == m))
for (c in unique(on_machine$compiler)) {
local <- on_machine %>%
filter(
as.vector(compiler == c),
implementation != 'cpu-range')
local <- local %>%
group_by(implementation, size) %>%
reframe(time = time / median(time), version, bin) %>%
group_by(bin, implementation, size) %>%
reframe(
relative.time = time,
version = unique(version),
)
plot <-
ggplot(
local,
aes(x = factor(size), y = relative.time, fill = version)) +
geom_boxplot(position = "dodge2", outlier.shape = NA) +
geom_hline(yintercept = 1) +
facet_grid(. ~ implementation) +
xlab("input text size") +
ylab("relative runtime") +
scale_x_discrete(labels=c(expression(2^19), expression(2^21), expression(2^23), expression(2^25), expression(2^27), expression(2^29))) +
theme(legend.position = "bottom")
plot <- plot + coord_cartesian(ylim = c(1 - .15, 1 + .10))
if (!dir.exists("plots/histo/"))
dir.create("plots/histo/", recursive = TRUE)
ggsave(
paste0("plots/histo/", m, "-", c, ".pdf"),
plot,
width = 4,
height = 3)
}
}