Jump to content

File:Barplot language speeds (Benchmarks Game Mandelbrot).svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia
    Original file (SVG file, nominally 974 × 923 pixels, file size: 15 KB)

    Summary

    Description
    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:
    w:en:Creative Commons
    attribution share alike
    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.

    Captions

    A Barplot of log transformed language speeds

    Items portrayed in this file

    depicts

    9 July 2021

    image/svg+xml

    fb7fb68a318413974581c24bfae4249bd6008784

    15,653 byte

    923 pixel

    974 pixel

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current08:35, 9 July 2021Thumbnail for version as of 08:35, 9 July 2021974 × 923 (15 KB)Ryan GreenupCross-wiki upload from en.wikipedia.org

    The following page uses this file:

    Global file usage

    The following other wikis use this file:

    Metadata