Skip to content

Instantly share code, notes, and snippets.


Wonsup Yoon Pusnow

View GitHub Profile

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](


Linux Hugepages

Hugepages are a hardware feature designed to reduce pressure on the translation lookaside buffer (TLB) for applications that operate on large contiguous memory regions.

Take a program that operates on a large 2MB internal structure as an example. If the program accesses that space in such a way that one byte in each regular 4k page is accessed, 2M/4k = 512 TLB entries are needed. Each TLB miss at the hardware level requires and interrupt and kernel intervention to resolve. However, if the allocation is backed by a 2M hugepage by mmap()ing with MAP_HUGETLB, only 1 TLB entry is required.

On x86_64, there are two hugepage sizes: 2MB and 1G. 1G hugepages are also called gigantic pages. 1G must be enabled on kernel boot line with hugepagesz=1G. Hugeages, especially 1G ones, should to be allocated early before memory fragments (i.e. at/near boot time) to increase the likelihood that they can be allocated successfully with minimal memory migration (i.e. defreg) required

kevinlee12 / Device Toggle.bat
Created Jan 28, 2016
Toggle Enable/Disable Device Windows
View Device Toggle.bat
@setlocal enableextensions enabledelayedexpansion
@echo off
rem ===========================================================================
rem The following toggles the touch screen on the Lenovo Thinkpad Yoga 12 using
rem DevCon.exe. Please ensure that you have Devcon.exe installed before running
rem this script. Please see Windows Device Console (Devcon.exe) page for Devcon
rem installation instructions.
rem This script must be run with admin privileges.