Skip to content

Instantly share code, notes, and snippets.

View silahian's full-sized 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
#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 2, 2024 03:21
Observer pattern created by silahian - https://repl.it/HpbL/15
#include <string>
#include <vector>
#include <thread>
#include <iostream>
#include <unistd.h>
using namespace std;
class IObserver
{
public:
@silahian
silahian / MemoryAllocationHFT.cpp
Last active October 17, 2023 12:03
Pre allocated vs dynamic arrays performance for low latency / high frequency trading systems
// 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)