Skip to content

Instantly share code, notes, and snippets.

View Gerold103's full-sized avatar

Vladislav Shpilevoy Gerold103

View GitHub Profile
@Gerold103
Gerold103 / CMakeLists.txt
Created May 8, 2024 16:42
Adserver Plugins
cmake_minimum_required(VERSION 3.0)
project(plugins)
########
add_library(mylib
mylib.cpp
)
target_compile_options(mylib PRIVATE -fPIC)
########
@Gerold103
Gerold103 / CMakeLists.txt
Last active May 2, 2024 11:11
CTR Predictor Test
cmake_minimum_required(VERSION 3.10)
project(predictor)
set(CMAKE_CXX_STANDARD 17)
# Append Torch path
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/libtorch")
# Find Torch
find_package(Torch REQUIRED)
message(STATUS "Torch found: ${Torch_FOUND}")
@Gerold103
Gerold103 / BenchObjectPool.cpp
Created October 20, 2023 16:02
BenchObjectPool
#include <atomic>
#include <cassert>
#include <condition_variable>
#include <ctime>
#include <iostream>
#include <mutex>
#include <random>
#include <thread>
template <typename T, uint32_t BatchSize>
@Gerold103
Gerold103 / BenchIOMultiplexing.cpp
Last active February 1, 2024 23:17
BenchIOMultiplexing
#include <atomic>
#include <cassert>
#include <cstring>
#include <ctime>
#include <fcntl.h>
#include <functional>
#include <iostream>
#include <netinet/in.h>
#include <poll.h>
#include <sstream>
@Gerold103
Gerold103 / BenchMemoryOrderX86.cpp
Last active October 9, 2023 18:52
BenchMemoryOrderX86
#include <atomic>
#include <iostream>
#define MEMORY_ORDER std::memory_order_relaxed
// #define MEMORY_ORDER std::memory_order_seq_cst
static constexpr int numberCount = 50;
static constexpr uint64_t targetValue = 1'000'000'000;
static uint64_t getUsec()
@Gerold103
Gerold103 / BenchScatterGatherIO.cpp
Created October 2, 2023 16:09
BenchScatterGatherIO
#include <cassert>
#include <cstring>
#include <ctime>
#include <iostream>
#include <thread>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
@Gerold103
Gerold103 / BenchIntrusiveList.cpp
Last active January 29, 2024 14:20
BenchIntrusiveList
#include <cstring>
#include <ctime>
#include <iostream>
#include <list>
#define USE_INTRUSIVE 1
#define USE_POINTER 1
#define MAKE_NOISE_FOR_STD_PTR 1
#if USE_POINTER
@Gerold103
Gerold103 / BenchFalseSharing.cpp
Last active September 29, 2023 16:11
BenchFalseSharing
#include <atomic>
#include <ctime>
#include <iostream>
#include <thread>
static constexpr int workerCount = 1;
static constexpr uint64_t target = 400'000'000;
// Vary this value between 0 and 128 to see the difference.
static constexpr int paddingSize = 128;
#!/bin/bash
# [Required]
# -s - subject;
# -c - first commit to send.
# [Optional]
# -b - branch name;
# -i - issue number;
# -h - print help;