Skip to content

Instantly share code, notes, and snippets.

View EricRahm's full-sized avatar

Eric Rahm EricRahm

View GitHub Profile
@EricRahm
EricRahm / patch_and_build.sh
Created May 13, 2020 18:12
x86_64 emulator build
#!/usr/bin/env bash
export LOCAL_NDK_BASE_URL='ftp://ftp.kaiostech.com/ndk/android-ndk'
mkdir patches
# Apply open PR for B2G repo
wget https://github.com/kaiostech/B2G/pull/4.patch -O patches/b2g.patch && patch -p1 < patches/b2g.patch
# Init
@EricRahm
EricRahm / build.sh
Created April 27, 2020 01:02
Fx Builds: Rust nightly vs 1.43 stable
#!/usr/bin/env bash
# Switch to the stable builds
rustup default stable
rustc -V
cargo -V
cat .mozconfig
echo ""
@EricRahm
EricRahm / build.sh
Created May 20, 2019 17:59
Build script for testing cargo pipelining
#!/usr/bin/env sh
# Switch to the nightly builds
rustup default nightly
rustc -V
cargo -V
# Baseline runs without pipelining
unset CARGO_BUILD_PIPELINING
echo -n "Initial run to populate ccache..."
@EricRahm
EricRahm / windows_10mb.md
Last active January 15, 2019 21:17
Reducing windows overhead to 10MB
Savings in KB Bug Title
2,000 1449600 Investigate reducing minimum GC memory
400 1470015 Investigate sharing font-related caches among Gecko processes
500 1364559 Consider extending SharedImmutableStringsCache to work between processes
500 1458339 Investigate sharing self-hosted compartment across content processes
250 1475091 Dropping rayon thread pool when a content process is inactive?
400 1474793 consider sharing UA style sheets across processes
128 1477393 Replace various watchdog/hang monitor threads with timers
100 1470339 Reduce the overhead of telemetry in content processes
@EricRahm
EricRahm / versions.md
Last active March 12, 2017 10:30
Browser versions used for Are They Slim Yet testing March 2017

Ubuntu 16.04 LTS

  • Firefox 55.0a1 (2017-03-08) (64-bit)
  • Chrome (aka chrome-unstable) 54.0.2810.2 dev (64-bit)

macOS 10.12.3

  • Firefox 55.0a1 (2017-03-08) (64-bit)
  • Chrome Version 59.0.3037.0 (Official Build) canary (64-bit)
  • Safari Tecnhology Preview Release 25 (Safari 10.2, WebKit 12604.1.8.1.2)
@EricRahm
EricRahm / rust-xml.md
Last active February 6, 2020 16:54
Gecko Rust XML Parser Requirements

Goal: Replace Gecko's XML parser, libexpat, with a rust-based XML parser

Reasoning:

  • Various integer overflow CVEs
  • Buffer overflows
  • Simplify, we don't need character conversion (which has lead to several CVEs)

Requirements:

  • push/sax based interface (lower memory, streaming)
  • supports DTD, entities
@EricRahm
EricRahm / .mozconfig
Created December 30, 2016 21:14
Example mozconfigs
ac_add_options --enable-debug
ac_add_options --enable-dmd
# NB: ccache disabled for comparitive build time testing.
#ac_add_options --with-ccache=/usr/bin/ccache
MOZ_MAKE_FLAGS="-j12"
export LD="/usr/bin/gold"
# For gcc-6.3.0
@EricRahm
EricRahm / mem_usage.md
Last active January 26, 2016 23:24
Comptetitve Analysis (Memory)

Test: TP5 (30 tabs, 10s per tab, 60s settle)

OS Browser Version RSS + USS
OSX 10.10.5 Google Chrome Canary 50.0.2627.0 1,419,870,208
OSX 10.10.5 Firefox Nightly + 1 CP 46.0a1 20160122030244 1,117,077,504
Ubuntu 14.04 Google Chrome Unstable 49.0.2618.8 dev (64-bit) 989,814,784
Ubuntu 14.04 Firefox Nightly + 1 CP 46.0a1 20160122030244 550,825,984
Windows 7 Google Chrome Canary 50.0.2631.0 canary (64-bit) 1,187,258,368
Windows 7 Firefox Nightly + 1 CP 47.0a1 20160126030244 537,321,472
#!/usr/bin/env python
import json
import jsonschema
import socket
import uuid
import time
from thclient import (TreeherderClient, TreeherderJobCollection, TreeherderArtifactCollection)
# These would come from a config
CLIENT_ID = 'awsy-local' # TODO(ER): Load from a config
@EricRahm
EricRahm / example.cpp
Created October 6, 2015 21:10
lambdas, oh my
LocallyDefinedMemoryReporter::CollectReports(...) {
// grab refs for stuff to shove in the lambda
nsCOMPtr<nsIHandleReportCallback> handleReport = aHandleReport;
nsCOMPtr<nsISupports> data = aData;
// this is defined elsewhere, we want it to hit the callback when it's refs drop to 0
nsRefPtr<MediaDecoder::ResourceSizes> resourceSizes = new MediaDecoder::ResourceSizes(MediaMemoryTracker::MallocSizeOf);
nsCOMPtr<nsIRunnable> callback = NS_NewRunnableFunction([handleReport, data, resourceSizes] () {
// NOTE: referencing resourcesSizes causes a cycle, so it's ref count will never go to 0
// so my goal is to not do that, preferably this function would be something like: