/
plot.R
1 #!/usr/bin/R
2
3 round_to_signif <- function(value, deviation) {
4 round(value, -floor(log(deviation)/log(10)))
5 }
6
7 boxplot_benchmark <- function(lisp_data, cxx_data) {
8 iterations <- lisp_data$ITERATIONS[1]
9 cxx_iterations <- cxx_data$ITERATIONS[1]
10 cxx_multiplier <- iterations / cxx_iterations
11
12 cxx_mean <- mean(cxx_data$PROCESSOR.CYCLES)
13 scaled_lisp_data <- lisp_data["PROCESSOR.CYCLES"]/cxx_mean/cxx_multiplier;
14 par(mfrow=c(1,2))
15 boxplot(c(cxx_data["PROCESSOR.CYCLES"]/cxx_mean, scaled_lisp_data),
16 log="y", names=c("C++", "Lisp"), ylab="processor cycles")
17 axis(4, at=c(round_to_signif(mean(scaled_lisp_data),
18 sd(scaled_lisp_data))))
19
20 cxx_mean <- mean(cxx_data$USER.RUN.TIME.US)
21 scaled_lisp_data <- lisp_data["USER.RUN.TIME.US"]/cxx_mean/cxx_multiplier;
22 boxplot(c(cxx_data["USER.RUN.TIME.US"]/cxx_mean, scaled_lisp_data),
23 log="y", names=c("C++", "Lisp"), ylab="user run time")
24 axis(4, at=c(round_to_signif(mean(scaled_lisp_data),
25 sd(scaled_lisp_data))))
26 par(mfrow=c(1,1))
27 }
28
29 pdf("benchmark.pdf", title="cl-smoke.benchmark")
30
31 info <- read.table("info.dat", header=TRUE)
32
33 cxx_simple_call <- read.table("cxx-simple-call.dat", header=TRUE)
34 simple_call <- read.table("simple-call.dat", header=TRUE)
35 boxplot_benchmark(simple_call, cxx_simple_call)
36 title("Simple Call",
37 paste(info$TYPE[1], info$VERSION[1], "on", info$OS[1], info$OS.VERSION[1]))
38
39 cxx_inline_call <- read.table("cxx-inline-call.dat", header=TRUE)
40 inline_call <- read.table("inline-call.dat", header=TRUE)
41 boxplot_benchmark(inline_call, cxx_inline_call)
42 title("Inline Call")
43
44 cxx_signal_slot <- read.table("cxx-signal-slot.dat", header=TRUE)
45 signal_slot <- read.table("signal-slot.dat", header=TRUE)
46 boxplot_benchmark(signal_slot, cxx_signal_slot)
47 title("Signal Slot")
48
49 #cxx_construct <- read.table("cxx-construct.dat", header=TRUE)
50 #construct <- read.table("construct.dat", header=TRUE)
51 #boxplot_benchmark(construct, cxx_construct)
52 #title("Construct Class")