Skip to content

Instantly share code, notes, and snippets.

View SanderMertens's full-sized avatar
🐥
Feeding flecs

Sander Mertens SanderMertens

🐥
Feeding flecs
View GitHub Profile
@lithdew
lithdew / sparse.zig
Created June 26, 2022 09:26
zig: generational paged sparse set
const std = @import("std");
const sparse = @This();
/// This is an implementation of a paged sparse set that stores the payload in
/// the sparse array.
//
/// A sparse set has a dense and a sparse array. The sparse array is directly
/// indexed by a 64 bit identifier. The sparse element is linked with a dense
/// element, which allows for liveliness checking. The liveliness check itself
@zeux
zeux / clang27.md
Last active January 27, 2024 11:45
How does clang 2.7 hold up in 2021?

A friend recently learned about Proebsting's law and mentioned it to me off hand. I knew about the law's existence but I never really asked myself - do I believe in it?

For people who aren't aware, Proebsting's law states:

Compiler Advances Double Computing Power Every 18 Years

Which is to say, if you upgrade your compiler every 18 years, you would expect on average your code to double in performance on the same hardware.

Let's C about this

@simonrenger
simonrenger / memoy_managment_cpp_resource_list.md
Last active April 23, 2024 21:30
C++ Memory Management Resource List
@dakom
dakom / ECS notes.md
Last active April 28, 2024 04:50
ECS with sparse array notes (EnTT style)

Intro

The below is a breakdown / bird's eye view of how a sparse-array backed ECS like EnTT or Shipyard works.

Please see the thanks and references at the bottom - without their help I would not have been able to share this breakdown with you... everything here is really just notes and rephrasing of what they've written already :)

Also, these notes do not cover archetype systems (like unity) nor adaptations of archetypes (like in Flecs). Though there's a couple comparative footnotes at the end.

Here we go!

@halfelf
halfelf / type_name.cpp
Created May 14, 2019 05:02
Get C++ type name
template <class T>
constexpr std::string_view type_name() {
#ifdef __clang__
std::string_view p = __PRETTY_FUNCTION__;
return std::string_view(p.data() + 34, p.size() - 34 - 1);
#elif defined(__GNUC__)
std::string_view p = __PRETTY_FUNCTION__;
# if __cplusplus < 201402
return std::string_view(p.data() + 36, p.size() - 36 - 1);
# else
@jleeothon
jleeothon / cortobootstrap.sh
Last active December 30, 2015 19:56
Set up Corto playground
workspaceparent="$HOME"
cd $workspaceparent
mkdir cortoproject
cd cortoproject
git clone https://github.com/cortoproject/corto
git clone https://github.com/cortoproject/c-binding
git clone https://github.com/cortoproject/xml
git clone https://github.com/cortoproject/corto-language
git clone https://github.com/cortoproject/io
@rtv
rtv / cond.c
Created February 19, 2013 19:56
An example of using pthread's condition variables, showing how to block a main thread while waiting for worker threads to finish their work, without joining the threads. This could be useful if you want to loop the threads, for example.
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
/* Compile like this:
gcc --std=c99 -lpthread cond.c -o cond