Created
April 26, 2017 09:33
-
-
Save Laurae2/e932ebd8ac9792eb63037f5e90a3d2e8 to your computer and use it in GitHub Desktop.
Code used for Medium blog post "Destroying the Myth of number of threads = number of physical cores": https://medium.com/data-design/destroying-the-myth-of-number-of-threads-number-of-physical-cores-762ad3919880
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(plotly) | |
library(ggplot2) | |
plot1 <- function(data, title) { | |
ggplot(data = data, aes(x = Threading, y = Score, fill = Score)) + geom_bar(stat = "identity", color = "black") + geom_label(aes(label = Score, y = mean(Score) * 0.05 + Score, fill = Score), position = "identity", color = "white", fontface = "bold") + scale_fill_gradientn(colours = c("#ff9999", "#33cc33")) + labs(title = title, x = "Threading Mode", y = "Cinebench R15 Score", fill = "Score") + theme_bw() | |
} | |
plot2 <- function(data, title) { | |
ggplot(data = data, aes(x = Threading, y = ScoreScale, fill = ScoreScale)) + geom_bar(stat = "identity", color = "black") + geom_label(aes(label = round(ScoreScale, digits = 2), y = mean(ScoreScale) * 0.05 + ScoreScale, fill = ScoreScale), position = "identity", color = "white", fontface = "bold") + scale_fill_gradientn(colours = c("#ff9999", "#33cc33")) + labs(title = title, x = "Threading Mode", y = "Scaled Cinebench R15 Score (GHz)", fill = "Scale") + theme_bw() | |
} | |
data <- data.frame(Threading = as.factor(paste0(c("[1] Single x", "[2] Multi Physical x", "[3] Multi Logical x", "[4] Multi Overcommit x"), c(1, 2, 4, 8))), | |
Score = c(121, 197, 260, 257)) | |
data$ScoreScale <- data$Score / c(3.3, rep(2 * 2.7, 3)) | |
plot1(data, "i7-4600U (2c/4t, 3.3/2.7 GHz) Cinebench R15 (Baremetal)") | |
plot2(data, "i7-4600U (2c/4t, 3.3/2.7 GHz) Cinebench R15 (Baremetal)") | |
data <- data.frame(Threading = as.factor(paste0(c("[1] Single x", "[2] Multi Physical x", "[3] Multi Logical x", "[4] Multi Overcommit x"), c(1, 6, 12, 24))), | |
Score = c(116, 613, 816, 786)) | |
data$ScoreScale <- data$Score / c(3.9, rep(6 * 3.5, 3)) | |
plot1(data, "i7-3930K (6c/12t, 3.9/3.5 GHz) Cinebench R15 (VMware)") | |
plot2(data, "i7-3930K (6c/12t, 3.9/3.5 GHz) Cinebench R15 (VMware)") | |
data <- data.frame(Threading = as.factor(paste0(c("[1] Single x", "[2] Multi Physical x", "[3] Multi Logical x", "[4] Multi Overcommit x"), c(1, 20, 40, 80))), | |
Score = c(111, 1777, 2270, 2114)) | |
data$ScoreScale <- data$Score / c(3.1, rep(20 * 2.7, 3)) | |
plot1(data, "Dual Quanta Freedom (2x 10c/20t, 3.1/2.7 GHz) Cinebench R15 (KVM)") | |
plot2(data, "Dual Quanta Freedom (2x 10c/20t, 3.1/2.7 GHz) Cinebench R15 (KVM)") | |
data <- data.frame(Threading = as.factor(rep(c("[1] Single", "[2] Multi Physical", "[3] Multi Logical", "[4] Multi Overcommit"), 3)), | |
Threads = c(1, 2, 4, 8, 1, 6, 12, 24, 1, 20, 40, 80), | |
Score = c(121, 197, 260, 257, 116, 613, 816, 786, 111, 1777, 2270, 2114), | |
Machine = c(rep("Small (i7-4600U, 2c/4t, 3.3/2.7 GHz, Baremetal)", 4), rep("Medium (i7-3930K, 6c/12t, 3.9/3.5 GHz, VMware)", 4), rep("Large (Dual Quanta Freedom, 2x 10c/20t, 3.1/2.7 GHz, KVM)", 4))) | |
data$ScoreScale <- data$Score / c(c(3.3, rep(2 * 2.7, 3)), c(3.9, rep(6 * 3.5, 3)), c(3.1, rep(20 * 2.7, 3))) | |
data$Penalty <- data$ScoreScale / c(rep(data$ScoreScale[1], 4), rep(data$ScoreScale[5], 4), rep(data$ScoreScale[9], 4)) | |
ggplot(data = data, aes(x = Machine, y = Score, fill = Score)) + geom_bar(stat = "identity", color = "black") + geom_label(aes(label = Score, y = Score, fill = Score), position = "identity", color = "white", fontface = "bold") + scale_fill_gradientn(colours = c("#ff9999", "#33cc33")) + labs(title = "All benchmarks (Cinebench R15)", x = "Threading Mode", y = "Cinebench R15 Score", fill = "Score") + facet_grid(Threading ~ ., scales = "free") + theme_bw() | |
ggplot(data = data, aes(x = Machine, y = ScoreScale, fill = ScoreScale)) + geom_bar(stat = "identity", color = "black") + geom_label(aes(label = round(ScoreScale, digits = 2), y = ScoreScale, fill = ScoreScale), position = "identity", color = "white", fontface = "bold") + scale_fill_gradientn(colours = c("#ff9999", "#33cc33")) + labs(title = "All Scaled benchmarks (Cinebench R15)", x = "Threading Mode", y = "Scaled Cinebench R15 Score (GHz)", fill = "Scale") + facet_grid(Threading ~ ., scales = "free") + theme_bw() | |
ggplot(data = data, aes(x = Machine, y = Penalty, fill = Penalty)) + geom_bar(stat = "identity", color = "black") + geom_label(aes(label = round(Penalty, digits = 2), y = Penalty, fill = Penalty), position = "identity", color = "white", fontface = "bold") + scale_fill_gradientn(colours = c("#ff9999", "#33cc33")) + labs(title = "All Single Thread Scaled benchmarks (Cinebench R15)", x = "Threading Mode", y = "Scaled Cinebench R15 Score (1 thread)", fill = "Scale") + facet_grid(Threading ~ ., scales = "free") + theme_bw() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment