add signal-slot benchmark & better graphs
Annotate for file plot.R
2009-05-25 tobias 1 #!/usr/bin/R
14:59:32 ' 2
2009-06-19 tobias 3 round_to_signif <- function(value, deviation) {
15:31:27 ' 4 round(value, -floor(log(deviation)/log(10)))
' 5 }
2009-05-25 tobias 6
14:59:32 ' 7 boxplot_benchmark <- function(lisp_data, cxx_data) {
2009-06-19 tobias 8 iterations <- lisp_data$ITERATIONS[1]
15:31:27 ' 9 cxx_iterations <- cxx_data$ITERATIONS[1]
' 10 cxx_multiplier <- iterations / cxx_iterations
' 11
2009-05-25 tobias 12 cxx_mean <- mean(cxx_data$PROCESSOR.CYCLES)
2009-06-19 tobias 13 scaled_lisp_data <- lisp_data["PROCESSOR.CYCLES"]/cxx_mean/cxx_multiplier;
15:31:27 ' 14 par(mfrow=c(1,2))
' 15 boxplot(c(cxx_data["PROCESSOR.CYCLES"]/cxx_mean, scaled_lisp_data),
2009-05-25 tobias 16 log="y", names=c("C++", "Lisp"), ylab="processor cycles")
2009-06-19 tobias 17 axis(4, at=c(round_to_signif(mean(scaled_lisp_data),
15:31:27 ' 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))
2009-05-25 tobias 27 }
14:59:32 ' 28
2009-06-19 tobias 29 pdf("benchmark.pdf", title="cl-smoke.benchmark")
15:31:27 ' 30
' 31 info <- read.table("info.dat", header=TRUE)
2009-05-25 tobias 32
14:59: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)
2009-06-19 tobias 36 title("Simple Call",
15:31:27 ' 37 paste(info$TYPE[1], info$VERSION[1], "on", info$OS[1], info$OS.VERSION[1]))
2009-05-25 tobias 38
14:59:32 ' 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
2009-06-19 tobias 44 cxx_signal_slot <- read.table("cxx-signal-slot.dat", header=TRUE)
15:31:27 ' 45 signal_slot <- read.table("signal-slot.dat", header=TRUE)
' 46 boxplot_benchmark(signal_slot, cxx_signal_slot)
' 47 title("Signal Slot")
2009-05-25 tobias 48
2009-06-19 tobias 49 #cxx_construct <- read.table("cxx-construct.dat", header=TRUE)
15:31:27 ' 50 #construct <- read.table("construct.dat", header=TRUE)
' 51 #boxplot_benchmark(construct, cxx_construct)
' 52 #title("Construct Class")