public

Graph code for JIT comparison blog post

  • Download Gist
ggplot-code-JIT-comparison.R
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
library(ggplot2)
library(reshape2)
 
jit <- read.csv("~/Desktop/jit.csv")
 
#Melt data into proper format
jitm <- melt(jit, id.vars='numsearch')
jitm$value = log(jitm$value)
 
#Create Overall ggplot for ln performance
ggplot(jitm) +
theme_bw(base_family="Garamond") +
theme(text = element_text(size=20)) +
ggtitle("Language Speed Comparison\n") +
xlab("\nFactorial Divisor Search") +
ylab("ln(seconds)\n") +
geom_line(aes(x=numsearch, y=value, colour=variable), size=1.2) +
guides(colour = guide_legend(title=NULL, override.aes = list(size=3))) +
scale_x_continuous(breaks=5:20) +
scale_y_continuous(breaks=NULL) +
scale_color_manual(values=c("slateblue2", "goldenrod1", "springgreen3", "lightsalmon2", "gray30", "darkgreen", "gold3", "pink"))
 
 
#Create ggplot for ln performance
#Python
 
python <- subset(jitm, variable == "python" | variable == "pypy" | variable == "python.numba.autojit")
 
ggplot(python) +
theme_bw(base_family="Garamond") +
theme(text = element_text(size=20)) +
ggtitle("Language Speed Comparison - Python\n") +
xlab("\nFactorial Divisor Search") +
ylab("ln(seconds)\n") +
geom_line(aes(x=numsearch, y=value, colour=variable), size=1.2) +
guides(colour = guide_legend(title=NULL, override.aes = list(size=3))) +
scale_x_continuous(breaks=5:20) +
scale_y_continuous(breaks=NULL) +
scale_color_manual(values=c("slateblue2", "goldenrod1", "springgreen3", "lightsalmon2", "gray30", "darkgreen", "gold3", "pink"))
 
#Create ggplot for ln performance
#R
 
r <- subset(jitm, variable == "r" | variable == "r.compiled" | variable == "pqr" | variable == "pqr.compiled")
 
ggplot(r) +
theme_bw(base_family="Garamond") +
theme(text = element_text(size=20)) +
ggtitle("Language Speed Comparison - R\n") +
xlab("\nFactorial Divisor Search") +
ylab("ln(seconds)\n") +
geom_line(aes(x=numsearch, y=value, colour=variable), size=1.2) +
guides(colour = guide_legend(title=NULL, override.aes = list(size=3))) +
scale_x_continuous(breaks=5:20) +
scale_y_continuous(breaks=NULL) +
scale_color_manual(values=c("slateblue2", "goldenrod1", "springgreen3", "lightsalmon2", "gray30", "darkgreen", "gold3", "pink"))

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.