Skip to content

Instantly share code, notes, and snippets.

@brson
brson / a.md
Created April 15, 2016 21:37
Rust heap profiling with jemalloc

I've never done this but I've heard it works.

Configure the Rust build like make JEMALLOC_FLAGS=--enable-prof. You might also want --enable-prof-libunwind.

Then run your program with something lke MALLOC_CONF=prof:true and it should dump stats to files called "jeprof*.out". Then you use the jeprof tool, which I am not sure how to get, to interpret it.

Here's a page with some ideas.

@brson
brson / a.txt
Last active May 17, 2020 22:09
ubuntu@ip-172-30-0-140:~/tikv4$ rustc -V
rustc 1.44.0-nightly (b2e36e6c2 2020-04-22)
ubuntu@ip-172-30-0-140:~/tikv4$ RUSTFLAGS="-Zsanitizer=address" cargo test -p tikv_util --target=x86_64-unknown-linux-gnu -- batch_rec
Finished test [unoptimized + debuginfo] target(s) in 1.30s
Running target/x86_64-unknown-linux-gnu/debug/deps/tikv_util-691515b7c083429f
running 1 test
test mpsc::batch::tests::test_batch_receiver ... ok
@brson
brson / comodo.pem
Created July 14, 2016 20:11
comodo cert authority
-----BEGIN CERTIFICATE-----
MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCB
hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV
BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMTE5
MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0IxGzAZBgNVBAgT
EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNh
dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR
6FSS0gpWsawNJN3Fz0RndJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8X
crates.io has https://github.com/rust-lang/crates.io/blob/master/docs/MIRROR.md as some loose docs and I believe there exist tools to sort of manage it for you and also mirror s3, but not sure
https://www.integer32.com/2016/10/08/bare-minimum-crates-io-mirror-plus-one.html
Bare Minimum Crates.io Mirror Plus One
I’ve been interested for a long time in making it easier toset up a mirror of crates.io. Making our vibrant ecosystem of librarieshighly available around the...
static.rust-lang.org measures in the dozens of terabytes range so I don't know if a mirror is really practical to maintain, nor am I sure if it'd be helpful as s3 seems fairly reliable
@brson
brson / time-passes-release.txt
Created April 7, 2019 04:10
Sum of time passes for tikv release profile 6ff46ed602017597823f5e868a1d37fadfd9ceab
LLVM passes - 1773.56
llvm module passes - 892.79
codegen passes - 488.64
LTO passes - 234.98
codegen - 112.45
codegen to LLVM IR - 75.24
ll link - 61.56
item-bodies checking - 47.36
llvm function passes - 28.94
linking - 28.15
@brson
brson / sum-time-passes.py
Last active April 7, 2019 04:09
Sum and sort rustc -Ztime-passes
import sys
import re
import operator
file = sys.argv[1]
r = re.compile("time: (\S.*); rss: (\S*)\s*(.*)")
map = { }
@brson
brson / sum-time-passes.txt
Last active April 7, 2019 03:20
TiKV sum of time-passes for commit 6ff46ed602017597823f5e868a1d37fadfd9ceab (debug build)
codegen passes - 216.57999999999936
codegen - 182.27599999999995
LLVM passes - 154.252
codegen to LLVM IR - 87.03499999999997
item-bodies checking - 68.76499999999999
linking - 42.206
write metadata - 41.588999999999984
running linker - 39.791
borrow checking - 35.21
monomorphization collection - 31.260999999999992
@brson
brson / sum-time-passes.py
Last active April 7, 2019 03:05
Script for accumulating and sorting output of rustc --Ztime-passes
import sys
import re
import operator
file = sys.argv[1]
r = re.compile("time: (\S.*); rss: (\S*)\s*(.*)")
map = { }
+ cargo benchcmp tikv-1.txt tikv-2.txt
name tikv-1.txt ns/iter tikv-2.txt ns/iter diff ns/iter diff % speedup
coprocessor::codec::batch::lazy_column::benches::bench_lazy_batch_column_by_vec_clone 44,240 45,071 831 1.88% x 0.98
coprocessor::codec::batch::lazy_column::benches::bench_lazy_batch_column_by_vec_push_raw_10bytes 49,509 48,678 -831 -1.68% x 1.02
coprocessor::codec::batch::lazy_column::benches::bench_lazy_batch_column_clone 15,579 15,017 -562 -3.61% x 1.04
coprocessor::codec::batch::lazy_column::benches::bench_lazy_batch_column_clone_10bytes 14,539 14,633 94 0.65% x 0.99
coprocessor::codec::batch::lazy_column::benches::bench_lazy_batch_column_clone_and_decode 35,682 28,494
==11220== DHAT, a dynamic heap analysis tool
==11220== NOTE: This is an Experimental-Class Valgrind Tool
==11220== Copyright (C) 2010-2015, and GNU GPL'd, by Mozilla Inc
==11220== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==11220== Command: target/debug/comrak -e table -e autolink script/progit.md
==11220==
==11220== error calling PR_SET_PTRACER, vgdb might block
==11220==
==11220== ======== SUMMARY STATISTICS ========
==11220==