Skip to content

Instantly share code, notes, and snippets.

View camel-cdr's full-sized avatar

Camel Coder camel-cdr

  • 19:14 (UTC +02:00)
View GitHub Profile
@Theldus
Theldus / README.md
Last active March 2, 2023 20:27
Helping your 'old' PC build faster with your mobile device (no root required)

Helping your 'old' PC build faster with your mobile device

It all happened when I decided to run Geekbench 5 on my phone: surprisingly the single-core performance matched my 'old'¹ Pentium T3200 and surpassed it in multicore. Since I've been having fun with distcc for the last few days, I asked myself: 'Can my phone really help my old laptop build faster? nah, hard to believe... but let's try'.

Without further ado: YES. Not only can my phone be faster, but it can significantly help in the build process, I believe the results below speak for themselves:

asciicast

Building Git (#30cc8d0) on a Pentium T3200, 8m30s

asciicast Building Git (#30cc8d0) on a Pentium T3200 (2x 2.0 GHz)+ Snapdragon 636 (4x1.8 + 4x1.6 GHz), 2m9s

@jeremy-rifkin
jeremy-rifkin / malloc.hpp
Last active April 6, 2022 12:37
High performance malloc implementation
uintptr_t base;
const uintptr_t height = 100000000;
std::mt19937 rng;
[[gnu::constructor]] void init_malloc() {
base = (uintptr_t) sbrk(height);
}
void* malloc(size_t) { // parameter ignored, we don't need it
return (void*)(base + rng() % height); // odds of any collision is like, low
}
void free(void*) {} // no-op
@easyaspi314
easyaspi314 / README.md
Last active May 30, 2021 17:23
C style void pointer/malloc wrapper for C++

C Style Malloc in C aka Void Pointers

One of the most annoying things about C++ is the incompatibility with C's void * conversion. In C, void * can be cast implicitly to any pointer type, but C++ needs an explicit cast.

Most C code is valid C++ code, but the most common issue is malloc, which returns void *.

For example, this is valid C code, but not valid C++ code:

struct Foo *x = malloc(sizeof(struct Foo));
@acapola
acapola / aes-ni.c
Created August 31, 2015 14:42
AES128 how-to using GCC and Intel AES-NI
#include <stdint.h> //for int8_t
#include <string.h> //for memcmp
#include <wmmintrin.h> //for intrinsics for AES-NI
//compile using gcc and following arguments: -g;-O0;-Wall;-msse2;-msse;-march=native;-maes
//internal stuff
//macros
#define DO_ENC_BLOCK(m,k) \
do{\