Skip to content

Instantly share code, notes, and snippets.

View osiewicz's full-sized avatar
🏃‍♂️
Working on runnables for Zed

Piotr Osiewicz osiewicz

🏃‍♂️
Working on runnables for Zed
View GitHub Profile
@osiewicz
osiewicz / ctre_issue_78_repro.cpp
Created November 12, 2019 22:59
CTRE issue 78 minimal reproducible code
#include <string_view>
#include "ctre.hpp"
constexpr static auto first = ctll::fixed_string {"(\\d{4})-(\\d{2})-(\\d{2})"};
constexpr static auto second = ctll::fixed_string {"(\\d{4})-(\\d{2})-(\\d{2})( |T)(\\d{2}):(\\d{2}):(\\d{2})"};
constexpr static auto third = ctll::fixed_string {"(\\d{4})-(\\d{2})-(\\d{2})( |T)(\\d{2}):(\\d{2}):(\\d{2})(\\.\\d{1,9})?"};
constexpr auto match_any(std::string_view view){
return ctre::match<first>(view) || ctre::match<second>(view) || ctre::match<third>(view);
}
@osiewicz
osiewicz / ctre_78_compile_time_bench_results
Last active December 23, 2019 15:17
CTRE issue 78 results
Command line:
time g++ -std=c++17 -O3 min_repro.cpp
No forced inlining:
real 0m2,210s
user 0m2,094s
sys 0m0,104s
Binary size: 280064
Forced inlining (current master):
@osiewicz
osiewicz / ctre_no_force_inline_78.patch
Created November 12, 2019 23:28
CTRE issue #78 patch to disable force inlining
diff --git a/single-header/ctre.hpp b/single-header/ctre.hpp
index 2a5accb..2c15a0b 100644
--- a/single-header/ctre.hpp
+++ b/single-header/ctre.hpp
@@ -462,7 +462,8 @@ template <typename CharT, size_t N> basic_fixed_string(basic_fixed_string<CharT,
#ifdef _MSC_VER
#define CTLL_FORCE_INLINE __forceinline
#else
-#define CTLL_FORCE_INLINE __attribute__((always_inline))
+//#define CTLL_FORCE_INLINE __attribute__((always_inline))
Benchmark 1: cargo +miri miri run --manifest-path /home/hiro/Projects/miri/bench-cargo-miri/backtraces/Cargo.toml
Time (mean ± σ): 9.940 s ± 0.192 s [User: 9.753 s, System: 0.113 s]
Range (min … max): 9.640 s … 10.220 s 10 runs
Benchmark 1: cargo +miri miri run --manifest-path /home/hiro/Projects/miri/bench-cargo-miri/mse/Cargo.toml
Time (mean ± σ): 1.612 s ± 0.012 s [User: 1.545 s, System: 0.058 s]
Range (min … max): 1.599 s … 1.641 s 10 runs
Benchmark 1: cargo +miri miri run --manifest-path /home/hiro/Projects/miri/bench-cargo-miri/serde1/Cargo.toml
Time (mean ± σ): 3.747 s ± 0.041 s [User: 3.637 s, System: 0.077 s]
@osiewicz
osiewicz / Cargo.toml
Created December 20, 2023 16:31
async-task excessive monomorphization example (https://github.com/smol-rs/async-task/issues/66)
[package]
name = "async-task-stresstest"
version = "0.1.0"
edition = "2021"
[dependencies]
# Apply the provided patch to the local copy of async-task.
async-task = {path = "../../async-task"}