Skip to content

Instantly share code, notes, and snippets.

View OlivierLi's full-sized avatar
🚀
Making things lean and fast!

Olivier Li OlivierLi

🚀
Making things lean and fast!
View GitHub Profile
@OlivierLi
OlivierLi / main.cpp
Created June 8, 2015 01:39
Code Jam treasure chest
#include <iostream>
#include <vector>
#include <sstream>
#include <deque>
#include <fstream>
#include <algorithm>
#include <set>
#include <bits/unique_ptr.h>
#include <bits/stl_map.h>
#include <functional>
#include <vector>
#include <future>
#include <iostream>
class MyType
{
public:
int value = 0;
int compute()
// test3.cpp : Defines the entry point for the console application.
//
#include <cassert>
#include <chrono>
#include <iostream>
#include <random>
#include <vector>
#include <cstdint>
#include <algorithm>
#include "stdafx.h"
#include <iostream>
#include <chrono>
#include <xmmintrin.h>
#include <cstring>
void test_sse( unsigned char *output, int *input )
{
//Create alligned arrays on the stack and the pointers needed to access them
#include "stdafx.h"
#include <iostream>
#include <chrono>
#include <immintrin.h>
#include <memory>
static inline bool isAligned( const void *pointer, size_t byte_count )
{
return (uintptr_t) pointer % byte_count == 0;
void test_sse( int *output, const int *input )
{
//SSE -> AVX transition
//_mm256_zeroall();
//Load the integers into an xmm register
__m256i loaded_ints = _mm256_loadu_si256( ( const __m256i* )input );
//Convert the integers to float values
__m256 values_reg = _mm256_cvtepi32_ps( loaded_ints );
cmake_minimum_required(VERSION 2.8)
project(skip_map)
SET(CMAKE_CXX_COMPILER clang++)
SET(CLANG_COMPILE_FLAGS "-Wall -Wextra -Wfatal-errors --std=c++14 -g")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLANG_COMPILE_FLAGS}" )
#Find all cpp files recursively
file(GLOB_RECURSE SRC "src" "*.cpp")
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <algorithm>
#include <map>
#include <cassert>
bool comp( const std::pair<size_t, size_t>& lhs, const std::pair<size_t, size_t>& rhs ) {return lhs.first < rhs.first; }
@OlivierLi
OlivierLi / map_vs_vec.cpp
Created March 29, 2016 14:51
Map VS Vec
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <algorithm>
bool comp( const std::pair<size_t, size_t>& lhs, const std::pair<size_t, size_t>& rhs ) {return lhs.first < rhs.first; }
int _tmain(int argc, _TCHAR* argv[])
{
#include <iostream>
#include <atomic>
#include <vector>
#include <thread>
// The point of this exercise is to implement a minimal demonstration and then quickly discuss the performance and correctness
// implications of the technique, if any.
// Example for loop unrolling: