Skip to content

Instantly share code, notes, and snippets.

Avatar

Ariel Silahian silahian

  • New York
View GitHub Profile
@silahian
silahian / busy-waiting-example.cpp
Created May 11, 2017 03:15
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 February 21, 2023 18:30
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 21:59
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)