#!/usr/bin/R round_to_signif <- function(value, deviation) { round(value, -floor(log(deviation)/log(10))) } boxplot_benchmark <- function(lisp_data, cxx_data) { iterations <- lisp_data$ITERATIONS[1] cxx_iterations <- cxx_data$ITERATIONS[1] cxx_multiplier <- iterations / cxx_iterations cxx_mean <- mean(cxx_data$PROCESSOR.CYCLES) scaled_lisp_data <- lisp_data["PROCESSOR.CYCLES"]/cxx_mean/cxx_multiplier; par(mfrow=c(1,2)) boxplot(c(cxx_data["PROCESSOR.CYCLES"]/cxx_mean, scaled_lisp_data), log="y", names=c("C++", "Lisp"), ylab="processor cycles") axis(4, at=c(round_to_signif(mean(scaled_lisp_data), sd(scaled_lisp_data)))) cxx_mean <- mean(cxx_data$USER.RUN.TIME.US) scaled_lisp_data <- lisp_data["USER.RUN.TIME.US"]/cxx_mean/cxx_multiplier; boxplot(c(cxx_data["USER.RUN.TIME.US"]/cxx_mean, scaled_lisp_data), log="y", names=c("C++", "Lisp"), ylab="user run time") axis(4, at=c(round_to_signif(mean(scaled_lisp_data), sd(scaled_lisp_data)))) par(mfrow=c(1,1)) } pdf("benchmark.pdf", title="cl-smoke.benchmark") info <- read.table("info.dat", header=TRUE) cxx_simple_call <- read.table("cxx-simple-call.dat", header=TRUE) simple_call <- read.table("simple-call.dat", header=TRUE) boxplot_benchmark(simple_call, cxx_simple_call) title("Simple Call", paste(info$TYPE[1], info$VERSION[1], "on", info$OS[1], info$OS.VERSION[1])) cxx_inline_call <- read.table("cxx-inline-call.dat", header=TRUE) inline_call <- read.table("inline-call.dat", header=TRUE) boxplot_benchmark(inline_call, cxx_inline_call) title("Inline Call") cxx_signal_slot <- read.table("cxx-signal-slot.dat", header=TRUE) signal_slot <- read.table("signal-slot.dat", header=TRUE) boxplot_benchmark(signal_slot, cxx_signal_slot) title("Signal Slot") #cxx_construct <- read.table("cxx-construct.dat", header=TRUE) #construct <- read.table("construct.dat", header=TRUE) #boxplot_benchmark(construct, cxx_construct) #title("Construct Class")