- Parallel Computing Course - Stanford CS149, Fall 2023
- Performance-Aware Programming Series by Casey Muratori
- Algorithms for Modern Hardware
- Computer Systems: A Programmer's Perspective, 3/E - by Randal E. Bryant and David R. O'Hallaron, Carnegie Mellon University
- Performance Engineering Of Software Systems - am MITOCW course
- Parallel Programming 2020 by NHR@FAU
- Cpu Caches and Why You Care - by Scott Meyers
- [Optimizing a ring buffer for throughput](https://rig
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
| stopifnot(requireNamespace("rlang")) | |
| rlang::check_installed("pak") | |
| pkgs <- rlang::chr( | |
| "rlang" = "rlang", | |
| "plumber2" = "posit-dev/plumber2", | |
| "S7", | |
| "jsonlite", | |
| "httr2", | |
| "mirai", |
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
| #' Fancy View function that opens a DataTable in the browser using DT package | |
| #' | |
| #' @param x The data to view | |
| #' @param title Optional title for the view | |
| #' @return Opens a browser window with the data in a DataTable | |
| #' @export | |
| fancy_view <- function(x, title = NULL) { | |
| # Check if x is provided | |
| if (missing(x)) { | |
| stop("No data provided to view. Please provide a data frame or other viewable object as the first argument.") |
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
| error404 = paste0( | |
| "<!DOCTYPE html>", | |
| "<html lang=\"en\">", | |
| "<head>", | |
| " <meta charset=\"UTF-8\">", | |
| " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">", | |
| " <title>Resources not found</title>", | |
| "</head>", | |
| "<body>", | |
| " <div class=\"main\">", |
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
| enum <- function(...) { | |
| vals <- if (is.null(...names())) { | |
| setNames(seq_len(...length()), c(...)) | |
| } else { | |
| c(...) | |
| } | |
| out <- new.env(parent = emptyenv()) | |
| list2env(as.list(vals), out) | |
| lapply(names(vals), lockBinding, out) | |
| lockEnvironment(out) |
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
| #* @assets ./public / | |
| list() | |
| n_clicked <- 0 | |
| #* @post /clicked | |
| #* @serializer html | |
| function() { | |
| n_clicked <<- n_clicked + 1 | |
| paste0("Clicked <b>", n_clicked, "</b>\n") | |
| } |
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
| ## Modify a vector in the workspace; x is a user-accessible symbol | |
| x <- 42 | |
| .Internal(inspect(x)) | |
| # @5631a3a19e20 14 REALSXP g0c1 [REF(5)] (len=1, tl=0) 42 | |
| x[1] <- 43 # modification causes a copy (address changes) | |
| .Internal(inspect(x)) | |
| # @5631a36c1cb8 14 REALSXP g0c1 [REF(4)] (len=1, tl=0) 43 | |
| ## Modify a vector inside a function; user cannot access y | |
| f <- function() { |
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
| #include <sys/types.h> | |
| #include <sys/stat.h> | |
| #include <sys/mman.h> | |
| #include <unistd.h> | |
| #include <fcntl.h> | |
| #include <Rinternals.h> | |
| #include <R_ext/Rallocators.h> | |
| static void *mmap_alloc(R_allocator_t *allocator, size_t length) { |