Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Harris harrism

View GitHub Profile
@harrism
harrism / useful_cpp_experiments.md
Last active Aug 5, 2020
Useful C++ experiments: a place to stash little C++ experiment results
View useful_cpp_experiments.md

Useful C++ experiments

A place to stash experiments I do with godbolt / quickbench / etc.

Which is faster for small data, std::map or std::unordered map?

https://quick-bench.com/q/70Eg-tVt3M4lR4tlMqv3_ZiOcYs

std::map seems faster below 128 items (when the map is int:int).

@harrism
harrism / Recurrence.cu
Last active Dec 1, 2021
Using Thrust for the Taylor series approximation of 1 / (1-x). Demonstrates evaluating recurrences in parallel with a scan using Thrust running on CUDA.
View Recurrence.cu
#include <thrust/scan.h>
#include <thrust/device_vector.h>
#include <thrust/fill.h>
#include <vector>
#include <algorithm>
#include <cstdlib>
int main(int argc, char **argv)
{
using T = double;