Skip to content

Instantly share code, notes, and snippets.

View Voultapher's full-sized avatar
🦕
Fight perfection

Lukas Bergdoll Voultapher

🦕
Fight perfection
  • MVTec Software GmbH
  • Munich, Germany
  • 22:33 (UTC +02:00)
View GitHub Profile
@Voultapher
Voultapher / sort-safety-addendum-c_std_sys.md
Created October 5, 2023 17:17
Sort safety addendum c_std_sys

image

@Voultapher
Voultapher / cli-tools.txt
Last active August 5, 2021 18:08
cli tools
No particular order:
rg | ripgrep
fd
tokei
dua | dua-cli
tldr | tealdeer
tig
hexyl
exa
@Voultapher
Voultapher / gen-nested-loops.hpp
Created June 26, 2020 10:04
C++ generate nested loops based on runtime loop bounds and static known loop depth.
// https://godbolt.org/z/-Zq5A9
#include <array>
#include <tuple>
#include <utility>
namespace detail {
class LoopFunc {
public:
LoopFunc(std::ptrdiff_t loop_max) : _loop_max{loop_max} {}
Linux 5.3.13-arch1-1
Benchmark code https://github.com/Voultapher/hashmap-compare 197ef4d9b2b27741a67eb96ff1828e7a83529594
clang version 9.0.0
Run on (4 X 3000 MHz CPU s)
CPU Caches:
L1 Data 32K (x2)
L1 Instruction 32K (x2)
@Voultapher
Voultapher / result_std_with_fx_vs_hashbrown.txt
Created December 8, 2018 11:14
Using https://github.com/Voultapher/hashmap-compare to compare rust std::collections::HashMap using fx hasher with hashbrown::HashMap running on Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz
----- Running rust benchmarks -----
Sat Dec 8 10:06:51 UTC 2018
CONFIGURATION: fx_hash
running 50 tests
test tests::big::clone ... bench: 6,507,451 ns/iter (+/- 2,369,267)
test tests::big::copy_element_wise ... bench: 9,405,607 ns/iter (+/- 1,097,552)
test tests::big::fill_only ... bench: 5,362,458 ns/iter (+/- 27,196)
test tests::big::insert_random ... bench: 7,773,228 ns/iter (+/- 77,974)
test tests::big::lookup_all ... bench: 5,816,665 ns/iter (+/- 86,600)
@Voultapher
Voultapher / overview.md
Created July 16, 2018 17:56
rustc vs clang | llvm production

Hello, I'm interested in rustc' compile time. Some preliminary test left me with some questions.

I measured building a minimal application. https://gist.github.com/Voultapher/ebc3abb55994ea90f3ac604c5ffccc19

Things I noticed:

  • nightly is significantly faster than stable, yay!
  • clang's full run is less than emit llvm ir + compile llvm ir
  • rustc's full run is much slower than emit llvm ir + compile llvm ir
@Voultapher
Voultapher / lib-min.rs
Last active July 16, 2018 17:51
rustc vs clang | llvm production | lib
pub fn foo(a: i64, b: i64) -> i64 {
(a % 239082) % b
}
pub fn bar(a: i64) -> i64 {
foo(a, 77)
}
@Voultapher
Voultapher / main.cpp
Last active July 16, 2018 17:49
rustc vs clang | llvm production | app
#include <cstdint>
auto foo(int64_t a, int64_t b) -> int64_t
{
return (a % 239082) % b;
}
auto bar(int64_t a) -> int64_t
{
return foo(a, 77);
@Voultapher
Voultapher / rust.ll
Created July 8, 2018 20:48
rustc --crate-type=lib -O main.rs --emit=llvm-ir
; ModuleID = 'main0-8787f43e282added376259c1adb08b80.rs'
source_filename = "main0-8787f43e282added376259c1adb08b80.rs"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%"unwind::libunwind::_Unwind_Exception" = type { [0 x i64], i64, [0 x i64], void (i32, %"unwind::libunwind::_Unwind_Exception"*)*, [0 x i64], [6 x i64], [0 x i64] }
%"unwind::libunwind::_Unwind_Context" = type { [0 x i8] }
; main::return_option
; Function Attrs: norecurse nounwind readnone uwtable
@Voultapher
Voultapher / cpp.ll
Created July 8, 2018 20:45
clang++ -O3 -std=c++17 main.cpp -emit-llvm -S
; ModuleID = 'main.cpp'
source_filename = "main.cpp"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
; Function Attrs: readnone sspstrong uwtable
define { i64, i8 } @_Z15return_optionall(i64) local_unnamed_addr #0 {
%2 = icmp slt i64 %0, 32
%3 = srem i64 %0, 752
%4 = zext i1 %2 to i8