Skip to content

Instantly share code, notes, and snippets.

Avatar

Ariel Silahian silahian

View GitHub Profile
@silahian
silahian / busy-waiting-example.cpp
Created May 11, 2017
busy-waiting-example created by silahian - https://repl.it/Hry2/1
View busy-waiting-example.cpp
#include <string>
#include <vector>
#include <thread>
#include <iostream>
#include <unistd.h>
using namespace std;
mutex mtxData;
class Consumer
{
@silahian
silahian / ObserverPattern.cpp
Last active May 12, 2022
Observer pattern created by silahian - https://repl.it/HpbL/15
View ObserverPattern.cpp
#include <string>
#include <vector>
#include <thread>
#include <iostream>
#include <unistd.h>
using namespace std;
class IObserver
{
public:
@silahian
silahian / MemoryAllocationHFT.cpp
Last active May 12, 2022
Pre allocated vs dynamic arrays performance for low latency / high frequency trading systems
View MemoryAllocationHFT.cpp
// Example program
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
// ***********************************
// This is for measuring CPU clocks
#if defined(__i386__)
static __inline__ unsigned long long rdtsc(void)