Skip to content

Instantly share code, notes, and snippets.

View gnzlbg's full-sized avatar

gnzlbg gnzlbg

View GitHub Profile
@gnzlbg
gnzlbg / randutils.hpp
Last active November 4, 2021 09:08 — forked from imneme/randutils.hpp
/*
* Random-Number Utilities (randutil)
* Addresses common issues with C++11 random number generation.
* Makes good seeding easier, and makes using RNGs easy while retaining
* all the power.
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Melissa E. O'Neill
*
@gnzlbg
gnzlbg / set
Last active August 22, 2021 11:11
set
Row;A;B;C
R1;1;0;0
R2;0;1;0
R3;0;0;1
;; Emacs: 28.0.50 Tramp: 2.5.0-pre -*- mode: outline; -*-
;; Location: /usr/local/Cellar/emacs-plus/HEAD-962562c/share/emacs/28.0.50/lisp/net/tramp.elc Git: /
15:52:26.791947 tramp-get-file-property (8) # file-attributes-string nil
15:52:26.793260 tramp-get-connection-property (7) # stat undef
15:52:26.793416 tramp-get-connection-property (7) # uname
15:52:26.793534 tramp-get-remote-stat (5) # Finding a suitable ‘stat’ command
15:52:26.793645 tramp-get-connection-property (7) # process-buffer nil
15:52:26.793800 tramp-get-connection-property (7) # process-buffer nil
15:52:26.793927 tramp-set-connection-property (7) # process-buffer nil
15:52:26.794058 tramp-get-connection-property (7) # process-buffer nil
nvme0n1
nvme0n1p1 vfat FAT32 ...
nvme0n1p2 crypto_LUKS 1 451331e2-e9a1-42d8-aff8-6dff4fd1944b
cryptroot btrfs root fef6185f-0281-4006-80c6-bf85efe0b63d
@gnzlbg
gnzlbg / compatible_trait.md
Last active December 13, 2019 13:33
Compatible and TryCompatible traits

Summary

This proposal introduces two traits, Compatible and TryCompatible, which allows specifying safe mem::transmute relationships and performing them in an

@gnzlbg
gnzlbg / report
Last active October 30, 2019 14:13
Consider this code:
struct foo {};
int id_foo(struct foo bar, int x) {
return x;
}
int id(int x) {
return x;
}
// WARNING: This output format is intended for human consumers only
// and is subject to change without notice. Knock yourself out.
fn S(_1: [f32; _]) -> S<N> {
let mut _0: S<N>; // return place in scope 0 at /Users/gnzlbg/projects/sideprojects/rust/src/test/ui/simd/simd-generics.rs:9:1: 9:36
bb0: {
(_0.0: [f32; _]) = move _1; // bb0[0]: scope 0 at /Users/gnzlbg/projects/sideprojects/rust/src/test/ui/simd/simd-generics.rs:9:1: 9:36
return; // bb0[1]: scope 0 at /Users/gnzlbg/projects/sideprojects/rust/src/test/ui/simd/simd-generics.rs:9:1: 9:36
}
}
name old ns/iter new ns/iter diff ns/iter diff % speedup
acos 3 2 -1 -33.33% x 1.50
acosf 2 3 1 50.00% x 0.67
acosh 114 132 18 15.79% x 0.86
acoshf 48 52 4 8.33% x 0.92
asin 2 4 2 100.00% x 0.50
asinf 2 3 1 50.00% x 0.67
atan 13 15 2 15.38% x 0.87
atan2 23 22 -1 -4.35% x 1.05
atan2f 11 15 4 36.36% x 0.73
[error]: Function "erf" not `extern "C"`
[error]: Function "erfc" not `extern "C"`
[error]: Function "floor" not `extern "C"`
[error]: Function "exp2f" not `extern "C"`
[error]: Function "fmaxf" not `extern "C"`
[error]: Function "fdimf" not `extern "C"`
[error]: Function "fmodf" not `extern "C"`
[error]: Function "ldexp" not `extern "C"`
[error]: Function "modf" not `extern "C"`
[error]: Function "modf" missing `#[inline]` and `#[no_panic]` attributes
name old ns/iter new ns/iter diff ns/iter diff % speedup
misc::anchored_literal_long_match 32 (12187 MB/s) 29 (13448 MB/s) -3 -9.38% x 1.10
misc::anchored_literal_long_non_match 35 (11142 MB/s) 35 (11142 MB/s) 0 0.00% x 1.00
misc::anchored_literal_short_match 32 (812 MB/s) 29 (896 MB/s) -3 -9.38% x 1.10
misc::anchored_literal_short_non_match 32 (812 MB/s) 35 (742 MB/s) 3 9.38% x 0.91
misc::easy0_1K 40 (26275 MB/s) 39 (26948 MB/s) -1 -2.50% x 1.03
misc::easy0_1MB 62 (16912951 MB/s) 66 (15887924 MB/s) 4 6.45% x 0.94
misc::easy0_32 40 (1475 MB/s) 43 (1372 MB/s) 3 7.50% x 0.93
misc::easy0_32K 40 (819875 MB/s)