Barplot_language_speeds_(Benchmarks_Game_Mandelbrot).svg
Size of this PNG preview of this SVG file:
633 × 600 pixels
.
Other resolutions:
253 × 240 pixels
|
507 × 480 pixels
|
810 × 768 pixels
|
1,081 × 1,024 pixels
|
2,161 × 2,048 pixels
|
974 × 923 pixels
.
Summary
Description Barplot language speeds (Benchmarks Game Mandelbrot).svg |
English:
A Barplot of log transformed language speeds adapted from the
Mandelbrot Benchmarks game
(using the best performing scripts for a selection of languages). Four perforrmance categories were identified by using heirarchical clustering via the following R Script:
library(ggplot2)
# Enter the data in such a way to match the Plot
data <-
rbind(
c("C", 0.97),
c("C++", 0.84),
c("Go", 3.75),
c("Rust", 0.93),
c("Julia", 1.32),
c("Python", 163 ),
c("Lua", 113),
c("Swift", 1.4 ),
c("Intel Fortran", 1.42),
c("Haskell GHC", 1.51),
c("C#", 3.14),
c("Chapel", 3.34),
c("F#", 3.77 ),
c("Pascal", 3.86),
c("Ada", 4.02),
c("Node JS", 4.03),
c("LISP", 4.09),
c("Java", 4.15),
c("OCaml", 7.53),
c("Dart", 8.72),
c("Racket", 10.45),
c("PHP", 24.89),
c("Erlang", 44),
c("Ruby", 262)
)
data <- apply(data, 2, rev)
data <- as.data.frame(data)
data[,2] <- as.numeric(data[,2])
data[,2] <- log(data[,2]+1)
# Make a Data Frame
df <- as.data.frame(data)
names(df) <- c("Language", "Time")
df$Language <- factor(seq_len(nrow(df)), labels = df$Language)
df$Time <- as.numeric(df$Time)
# If you want it ordered in descending uncomment below
# df[rank(df$Time), ]
# Make sure the languages keep the order they were given in
# I want them in a specific order
df$Language <- factor(sort(df$Time), labels = df$Language)
factor(df$Language, ordered = TRUE, levels = rank(df$Time))
# Identify clusters with heirarchical clustering
times <- df$Time; names(times) <- df$Language
hc.av <- hclust(dist(times), method = "average")
plot(hc.av)
df$Category <- factor(cutree(tree = hc.av, k = 4))
levels(df$Category) <- rev(levels(df$Category))
# Build the Plot
p <- ggplot(df, aes(x = Language, y = Time, fill = Category )) +
geom_col(col = 'black') +
labs(y = "Log Time",
title = "Comparison of Programming Language", subtitle = "Log Time to Produce 1600² Mandelbrot") +
guides(fill = guide_legend("Performance\nCategory")) +
theme_classic() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
coord_flip()
ggsave("/tmp/barplot_language_speeds.svg")
p
|
Date | |
Source | Own work |
Author | Ryan Greenup |
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the
Creative Commons
Attribution-Share Alike 4.0 International
license.
-
You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
-
Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
This media file is uncategorized.
Please help improve this media file by adding it to one or more categories, so it may be associated with related media files (
how?
), and so that it can be more easily found.
Please notify the uploader with
{{subst:Please link images|File:Barplot language speeds (Benchmarks Game Mandelbrot).svg}} ~~~~
|