Skip to content

Instantly share code, notes, and snippets.

View orangejulius's full-sized avatar
🌍
making Geocode Earth and open data better :)

Julian Simioni orangejulius

🌍
making Geocode Earth and open data better :)
View GitHub Profile
@orangejulius
orangejulius / testWriteAmplification.c
Created November 29, 2012 08:16
C program to write 4096 bytes starting at a random 512b sector, with sector offset passed in from the command line. Try it with your 4K sector hard drive (or SSD): non zero offsets will significantly reduce performance. Use only on an empty disk
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
char buffer[4096];
int main(int argc, char *argv[])
{
int fd, i, off;
long bk, byte;
@orangejulius
orangejulius / mymemcpy.c
Created October 5, 2012 23:25
Simple memcpy implementation
#include <stdio.h>
#include <string.h>
void* my_memcpy(void* destination, void* source, size_t num)
{
int i;
char* d = destination;
char* s = source;
for (i = 0; i < num; i++) {
d[i] = s[i];
@orangejulius
orangejulius / Makefile
Created May 26, 2012 00:46
strlen performance comparison
all: mystrlen strlen
mystrlen: mystrlen.c makestrs.h
gcc -O2 mystrlen.c -o mystrlen
strlen: strlen.c makestrs.h
gcc -O2 strlen.c -o strlen
clean:
rm mystrlen strlen
test: mystrlen strlen
time ./mystrlen > /dev/null
time ./strlen > /dev/null