Skip to content

Instantly share code, notes, and snippets.

View tiehuis's full-sized avatar

Marc Tiehuis tiehuis

View GitHub Profile
@tiehuis
tiehuis / 0build.sh
Last active July 21, 2023 08:04
xxhash benchmarks
#!/bin/bash
# See https://github.com/ziglang/zig/commit/22cd7156a48136017656b4c9309bba9041a46bfd
cd .. && zig build-lib --zig-lib-dir $HOME/src/zig/lib zig_hashes.zig -O ReleaseFast -femit-bin=zig_hashes.a
cd build && make
const std = @import("std");
const builtin = @import("builtin");
const Builder = std.build.Builder;
pub fn build(b: *Builder) void {
const exe = b.addExecutable("fuzz", "fuzz.zig");
exe.setBuildMode(builtin.Mode.ReleaseFast);
exe.linkSystemLibrary("c");
exe.linkSystemLibrary("gmp");
exe.setOutputDir(".");
@tiehuis
tiehuis / throughput_poly1305.zig
Created August 30, 2018 05:52
poly1305/x25519 benchmark scripts
const std = @import("std");
const time = std.os.time;
const Timer = time.Timer;
const poly1305 = @import("poly1305.zig");
const MiB = 1024 * 1024;
const BytesToHash = 128 * MiB;
pub fn main() !void {
@tiehuis
tiehuis / remove_inline.patch
Created September 10, 2017 06:21
zig-git arch package patch
std/os/linux_x86_64.zig | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/std/os/linux_x86_64.zig b/std/os/linux_x86_64.zig
index 0f8f163..9a3282a 100644
--- a/std/os/linux_x86_64.zig
+++ b/std/os/linux_x86_64.zig
@@ -370,14 +370,14 @@ pub const F_GETOWN_EX = 16;
pub const F_GETOWNER_UIDS = 17;
@tiehuis
tiehuis / main.c
Created April 22, 2017 04:41
Generic Data Structures in C
#include "qvec.h"
typedef char* string;
typedef struct {
int x, y;
} Tuple;
int main(void)
{
@tiehuis
tiehuis / test-rg-colors.sh
Created April 18, 2017 10:38
quick rg color test
#!/usr/bin/bash
echo -e "\n256-color approximation\n"
for i in `seq 0 255`; do
printf "\x1b[48;5;${i}m \x1b[0m - "
./target/debug/rg 'door-m' grep/src/data/sherlock.txt --colors "match:bg:$i" --colors "match:fg:$i" --only-matching -N
done
echo -e "\nTrue-color approximation\n"
macro_rules! foo {
($id:ident) => {
struct $id {}
fn new() -> &'static $id {
$id {}
}
}
}