Skip to content

Instantly share code, notes, and snippets.

@antiguru
antiguru / readme.md
Created July 5, 2023 15:41
Materialize w/sccache

Clean build:

    Finished dev [unoptimized + debuginfo] target(s) in 9m 53s

Every 2.0s: /home/moritz/.cargo/bin/sccache -s    cumin-pc: Wed Jul  5 17:36:34 2023

Compile requests                   1493
Compile requests executed          1290
Cache hits                            1
Cache hits (C/C++)                    1
docker run --name=cockroach -d -p 26257:26257 -p 26258:8080 cockroachdb/cockroach:v22.2.0 start-single-node --insecure --store=type=mem,size=2G
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'>
<title>Mail Filters</title>
<id>tag:mail.google.com,2008:filters:z0000001674574503141*7110969619627426180,z0000001674574661763*6454666868134005018,z0000001674575197964*8528373595103071961</id>
<updated>2023-02-02T16:15:20Z</updated>
<entry>
<category term='filter'></category>
<title>Mail Filter</title>
<id>tag:mail.google.com,2008:filter:z0000001674574503141*7110969619627426180</id>
<updated>2023-02-02T16:15:20Z</updated>
@antiguru
antiguru / merger.rs
Created January 2, 2022 16:54
A Rust data structure to merge sorted iterators
use std::cmp::{Ordering, Reverse};
use std::collections::BinaryHeap;
struct Head<I: Iterator>(I, I::Item);
impl<I: Iterator> Eq for Head<I> where I::Item: Eq {}
impl<I: Iterator> PartialEq for Head<I>
where
I::Item: Eq,
@antiguru
antiguru / Cargo.toml
Last active December 7, 2021 07:57
Patch Timely and Differential in Materialize
[patch."https://github.com/TimelyDataflow/timely-dataflow"]
timely = { path = "../timely-dataflow/timely" }
[patch."https://github.com/TimelyDataflow/differential-dataflow"]
differential-dataflow = { path = "../differential-dataflow" }
dogsdogsdogs = { path = "../differential-dataflow/dogsdogsdogs" }

Size of stack frames

This determines the size of stack frames in a binary by inspecting the sub %rsp instructions in a very crude way. It might be incorrect on account of not all functions using the stack the same way or consistently.

objdump -d target/release/materialized \
  | grep 'sub.*rsp$\|>:' \
  | sed -n '$!N;/sub/P;D' \
  | grep "sub " -1 \
@antiguru
antiguru / mz-type-size.md
Last active November 18, 2021 14:43
Materialize type size analysis

Run:

RUSTFLAGS="-Zprint-type-sizes" cargo +toolchain check 2>&1 | tee rust_sizes.txt
grep " type.*bytes" rust_sizes.txt | sed 's/:\(.*\):\(.*\):\(.*\)/\2 \3 \1/' | sort -u | sort -nk3 | less

This will include output like the following:

print-type-size type 1160 bytes, alignment  8 bytes  `plan::Sink`
print-type-size type 1160 bytes, alignment  8 bytes  `sql::plan::Sink`
@antiguru
antiguru / rotate.sh
Last active September 23, 2018 09:24 — forked from h4cc/rotate.sh
Lenovo X220 Tablet rotation script (sets rotation, wacom rotation, subpixel rendering)
#!/bin/bash
# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation.
rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"
# Find input devices to be rotated.
IFS=$'\n'
devices=("$(xinput --list --name-only | egrep '(Wacom)|(TrackPoint)')")