Skip to content

Instantly share code, notes, and snippets.

View ldionne's full-sized avatar

Louis Dionne ldionne

View GitHub Profile
@ldionne
ldionne / CMakeLists.txt
Last active April 30, 2016 16:41
Benchmarking different patterns of overload resolution
# Copyright Louis Dionne 2016
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
cmake_minimum_required(VERSION 3.2)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
include(metabench)
@ldionne
ldionne / CMakeLists.txt
Last active April 30, 2016 23:18
Benchmarking compilation time w.r.t. symbol lengths generated by expression templates
# Copyright Louis Dionne 2016
# Distributed under the Boost Software License, Version 1.0.
cmake_minimum_required(VERSION 3.2)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
include(metabench)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ldionne
ldionne / .gitignore
Last active May 11, 2016 14:47
Exploring code generation with large structs and arrays
build/
@ldionne
ldionne / P0107.diff
Created June 8, 2016 02:17
Patch to implement P0107 in libc++
commit 4d6f53adf9ddb41ae6b477a39b8b609159c74cf2
Author: Louis Dionne <ldionne.2@gmail.com>
Date: Tue May 24 15:36:02 2016 -0700
[array] Implement P0107 improving the support for constexpr in std::array
diff --git a/include/array b/include/array
index 719286d..28d093d 100644
--- a/include/array
+++ b/include/array
@ldionne
ldionne / CMakeLists.txt
Created November 8, 2016 14:53
Benchmark of hana::string w/ c_str() method
# Copyright Louis Dionne 2016
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
set(datasets)
add_dataset(datasets hetero make hana string1 hana.string.cpp.erb 4 "(0..50).step(10).to_a + (100..300).step(50).to_a" "which\;1")
add_dataset(datasets hetero make hana string2 hana.string.cpp.erb 4 "(0..50).step(10).to_a + (100..300).step(50).to_a" "which\;2")
add_chart(hetero make DATASETS ${datasets})
@ldionne
ldionne / issaquah_2016_reflection.cpp
Created March 2, 2017 17:15
Library-based value-syntax for reflection as shown in Issaquah
//
// A demo of value-syntax reflection built on top of the current reflection proposal,
// as shown to the Reflection SG at the Issaquah meeting in 2016.
//
// Author: Louis Dionne
//
// ~/code/llvm/build/prefix/bin/clang++ -I ~/code/hana/include -isystem ~/code/llvm/build/prefix/lib/clang/4.0.0/include -I ~/code/llvm/tools/clang/reflection -Xclang -freflection -std=c++1z code/worksheet.cpp
@ldionne
ldionne / constexpr_control_flow.cpp
Created March 3, 2017 19:28
Scratchpad for compile-time control flow
void foo() {
for (auto x : tuple) {
if (runtime-bool) // ill formed
constexpr break;
}
}
void foo() {
for (auto x : tuple) {
if constexpr (compile-time-bool) // yes!
@ldionne
ldionne / minimal-handwritten-config-header-only.cmake
Last active June 20, 2017 01:14
CMake Package Config for Boost
# Compute the installation prefix relative to this file. This file is expected
# to be located at ${PREFIX}/lib/cmake/Hana/HanaConfig.cmake, so this simply
# computes the installation's ${PREFIX}.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "")
endif()
@ldionne
ldionne / codegen.cpp
Created May 23, 2018 01:52
example of bad codegen with Hana
#include <cstddef>
#include <type_traits>
#include <utility>
//////////////////////////////////////////////////////////////////////////////
// Utilities required to make the bug report self-contained.
//
// Basically, this defines a very minimal tuple<> structure along with a
// function (operator+) which allows appending an element to a tuple. We
@ldionne
ldionne / pre-push
Created November 9, 2018 19:26
Pre-push hook for LLVM monorepo
#!/bin/sh
# Pre-push hook making sure there is no merge commit in the set of commits
# being pushed upstream. This hooks works by walking the set of commits being
# pushed and making sure that none of them has two parents or more (which is
# the definition of a merge commit).
#
# This hook is called with the following parameters:
#
# ${1} -- Name of the remote to which the push is being done