Skip to content

Instantly share code, notes, and snippets.

View carlmartus's full-sized avatar

Martin Sandgren carlmartus

View GitHub Profile
@arq5x
arq5x / test.sh
Last active November 30, 2023 12:50
Compress and then Decompress a string with zlib.
# compile
$ g++ zlib-example.cpp -lz -o zlib-example
# run
$ ./zlib-example
Uncompressed size is: 36
Uncompressed string is: Hello Hello Hello Hello Hello Hello!
----------
@zhoukuo
zhoukuo / cost_us.c
Created July 13, 2012 03:21
Calculate the execution time of microseconds
/* use gettimeofday() to calculate the execution time in microseconds */
#include <sys/time.h>
long timecost(void (*dosomething)())
{
struct timeval start, end;
long cost;
gettimeofday(&start, NULL);
dosomething();
gettimeofday(&end, NULL);
@spion
spion / a-warning.md
Last active March 25, 2024 03:01
C++ versus V8 versus luajit versus C benchmark - (hash) tables

Warning

This benchmark has been misleading for a while. It was originally made to demonstrate how JIT compilers can do all sorts of crazy stuff to your code - especially LuaJIT - and was meant to be a starting point of discussion about what exactly LuaJIT does and how.

As a result, its not indicative of what its performance may be on more realistic data. Differences can be expected because

  1. the text will not consist of hard-coded constants
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 9, 2024 10:41
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname