-
Notifications
You must be signed in to change notification settings - Fork 370
Expand file tree
/
Copy pathplot.r
More file actions
executable file
·132 lines (109 loc) · 5.4 KB
/
plot.r
File metadata and controls
executable file
·132 lines (109 loc) · 5.4 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/usr/bin/env Rscript
# Usage:
#
# plot.r data.csv
#
# Output will be placed in SVG files.
library(ggplot2)
args <- commandArgs(trailingOnly = TRUE)
data <- read.table(args[1], header = TRUE, sep = ",")
jitterBoxPlot <- function(data, operation, titleText) {
print(paste(operation, "---------------------------------------------------------------------------"))
operationData <- subset(data, data$Operation == operation)
operationData$Implementation.and.Browser <- factor(
operationData$Implementation.and.Browser,
levels = c(
"JavaScript.Chrome.Canary",
"WebAssembly.Chrome.Canary",
"JavaScript.Firefox.Nightly",
"WebAssembly.Firefox.Nightly"
)
)
chromeJs <- subset(operationData,
operationData$Implementation.and.Browser == "JavaScript.Chrome.Canary")$Time
print(paste("mean: scala.js: Chrome+JS =", mean(chromeJs)))
print(paste("cv: scala.js: Chrome+JS =", sd(chromeJs) / mean(chromeJs)))
chromeWasm <- subset(operationData,
operationData$Implementation.and.Browser == "WebAssembly.Chrome.Canary")$Time
print(paste("mean: scala.js: Chrome+Wasm =", mean(chromeWasm)))
print(paste("cv: scala.js: Chrome+Wasm =", sd(chromeWasm) / mean(chromeWasm)))
firefoxJs <- subset(operationData,
operationData$Implementation.and.Browser == "JavaScript.Firefox.Nightly")$Time
print(paste("mean: scala.js: Firefox+JS =", mean(firefoxJs)))
print(paste("cv: scala.js: Firefox+JS =", sd(firefoxJs) / mean(firefoxJs)))
firefoxWasm <- subset(operationData,
operationData$Implementation.and.Browser == "WebAssembly.Firefox.Nightly")$Time
print(paste("mean: scala.js: Firefox+Wasm =", mean(firefoxWasm)))
print(paste("cv: scala.js: Firefox+Wasm =", sd(firefoxWasm) / mean(firefoxWasm)))
print(paste("normalized: Chrome =", mean(chromeWasm) / mean(chromeJs)))
print(paste("normalized: Firefox =", mean(firefoxWasm) / mean(firefoxJs)))
thePlot <- ggplot(operationData,
aes(x = operationData$Implementation.and.Browser,
y = operationData$Time,
color = operationData$Implementation.and.Browser,
pch = operationData$Implementation.and.Browser)) +
geom_boxplot(outlier.shape = NA) +
geom_jitter(position = position_jitter(width = 0.1)) +
scale_y_continuous(limits = quantile(operationData$Time, c(NA, 0.99))) +
expand_limits(y = 0) +
theme(legend.position = "none",
axis.text.x = element_text(angle = 45, hjust = 1),
axis.title.x = element_blank()) +
ggtitle(titleText) +
labs(y = "Time (ms)",
subtitle = "Scala.JS Source Map (Mappings String Size = 14,964,446)")
## print(thePlot)
svgFile <- paste(operation, ".scalajs.svg", sep="")
ggsave(plot = thePlot,
file = svgFile,
device = "svg")
}
largeData <- subset(data, Mappings.Size==14964446)
jitterBoxPlot(largeData, "set.first.breakpoint", "Set First Breakpoint")
jitterBoxPlot(largeData, "subsequent.setting.breakpoints", "Subsequent Setting Breakpoints")
jitterBoxPlot(largeData, "first.pause.at.exception", "First Pause at Exception")
jitterBoxPlot(largeData, "subsequent.pausing.at.exceptions", "Subsequent Pausing at Exceptions")
jitterBoxPlot(largeData, "parse.and.iterate", "Parse and Iterate Each Mapping")
jitterBoxPlot(largeData, "iterate.already.parsed", "Already Parsed, Iterate Each Mapping")
meanPlot <- function(data, operation, titleText) {
operationData <- subset(data, data$Operation == operation)
operationData$Implementation.and.Browser <- factor(
operationData$Implementation.and.Browser,
levels = c(
"JavaScript.Chrome.Canary",
"WebAssembly.Chrome.Canary",
"JavaScript.Firefox.Nightly",
"WebAssembly.Firefox.Nightly"
)
)
thePlot <- ggplot(operationData,
aes(x = operationData$Mappings.Size,
y = operationData$Time,
color = operationData$Implementation.and.Browser,
pch = operationData$Implementation.and.Browser)) +
stat_summary(fun.y = mean, geom = "line") +
stat_summary(fun.y = mean, geom = "point") +
geom_point() +
theme(legend.position = "bottom",
legend.direction="vertical",
legend.title = element_blank()) +
scale_y_continuous(limits = quantile(operationData$Time, c(NA, 0.99))) +
## scale_x_log10() +
## scale_y_log10() +
expand_limits(y = 0) +
ggtitle(titleText) +
labs(x = "Mappings String Size",
y = "Time (ms)",
subtitle = "Mean")
## print(thePlot)
svgFile <- paste(operation, ".mean.svg", sep="")
ggsave(plot = thePlot,
file = svgFile,
device = "svg")
}
meanPlot(data, "set.first.breakpoint", "Set First Breakpoint")
meanPlot(data, "subsequent.setting.breakpoints", "Subsequent Setting Breakpoints")
meanPlot(data, "first.pause.at.exception", "First Pause at Exception")
meanPlot(data, "subsequent.pausing.at.exceptions", "Subsequent Pausing at Exceptions")
meanPlot(data, "parse.and.iterate", "Parse and Iterate Each Mapping")
meanPlot(data, "iterate.already.parsed", "Already Parsed, Iterate Each Mapping")