Skip to content

Instantly share code, notes, and snippets.

View mchtilianov's full-sized avatar

Martin Chtilianov mchtilianov

  • Sofia, Bulgaria & San Diego, California
View GitHub Profile
// Compile and run with:
//
// gcc -O3 -march=native fast-strlen.c -lpthread -o fast-strlen
// && ./fast-strlen
//
// Use gcc because clang is too smart and optimizes away parts of the
// benchmark. Results on Xeon(R) CPU E5-2650 v4 @ 2.20GHz with gcc
// 9.4.0:
//
// Scanning 10 times over 4.00GB...
@kconner
kconner / macOS Internals.md
Last active July 7, 2024 19:42
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@cellularmitosis
cellularmitosis / HashTable.c
Last active May 10, 2023 02:46
Hash table in C, part 1: a humble beginning
#include "HashTable.h"
#include <stdio.h> // fprintf
#include <stdlib.h> // exit
#include <string.h> // memset
#include <stdint.h> // uint8_t
void* dmalloc(size_t size) {
void* p = malloc(size);
if (p == NULL) {
@WhiteBlackGoose
WhiteBlackGoose / GenericTensor.md
Last active March 16, 2023 05:53
This is a short article about how I managed to implement basic generic tensor library

Generic tensor library in C# in a week

Hello!

For this article we take Tensor as a N-dimensional array whose last two axes might be interpreted as Matrix and/or the last axis might be interpreted as Vector. For TLDR the result is here.

What do we want?

  1. Tensors (N-dimensional storage)
  2. Implementation of methods and functions for working with tensors as with data storages
@fay59
fay59 / Quirks of C.md
Last active January 23, 2024 04:24
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;