Skip to content

Instantly share code, notes, and snippets.

View nyurik's full-sized avatar

Yuri Astrakhan nyurik

View GitHub Profile
@nyurik
nyurik / github_contrib.md
Last active June 4, 2024 19:41
Best practices on contributing to FOSS with GitHub

Contributing to FOSS

Open source contribution is both a technical and a social phenomenon. Any FOSS project naturally has a "caste system" - a group of contributors with extensive rights vs everyone else. Some of this separation is necessary - core contributors have deeper knowledge of the code, share vision, and trust each other.

Core contributors have one more right that others do not -- they can create repository branches. Thus, they can contribute "locally" - by pushing proposed changed to the primary repository's work branches,

https://docs.google.com/presentation/d/1iQFFMCuIPLYdUiEgeFsO8fKTQB6ArSM8GrxLKXxY-RQ/edit?usp=sharing
https://docs.google.com/presentation/d/1Rl3k_bu7e3YZ-p8mGoQ-rqeJIUUlr6JfDSTCg3cWAog
@nyurik
nyurik / format.rs
Last active June 1, 2023 01:21
Rust format! double referencing performance impact
// Place this page as /benches/format.rs in a rust project created with `cargo new fmttest --lib`
// Add to Cargo.toml:
//
// [dev-dependencies]
// criterion = { version = "0.4", features = ["html_reports"] }
//
// [[bench]]
// name = "format"
// harness = false
@nyurik
nyurik / benches_iters.rs
Last active May 9, 2023 02:37
Add “iterate with separators” iterator function
// Benchmarks for the Rust iterator extension discussion at
// https://internals.rust-lang.org/t/add-iterate-with-separators-iterator-function/18781/13
// Place this page as /benches/iters.rs in a rust project created with `cargo new itertest --lib`
// Add to Cargo.toml:
//
// [dependencies]
// itertools = "0.10"
//
@nyurik
nyurik / bench.rs
Created April 5, 2023 19:30
Benchmark to evaluate linear vs dup-indexer performance
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use dup_indexer::DupIndexer;
fn benchmark_strings(c: &mut Criterion) {
let mut group = c.benchmark_group("Strings");
group.bench_function("String", |b| {
b.iter(|| {
let mut di = DupIndexer::new();
for _ in 0..100 {