Skip to content

Instantly share code, notes, and snippets.


Eric Rahm EricRahm

View GitHub Profile
EricRahm /
Created May 13, 2020
x86_64 emulator build
#!/usr/bin/env bash
mkdir patches
# Apply open PR for B2G repo
wget -O patches/b2g.patch && patch -p1 < patches/b2g.patch
# Init
EricRahm /
Created Apr 27, 2020
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 /
Created May 20, 2019
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
echo -n "Initial run to populate ccache..."
EricRahm /
Last active Jan 15, 2019
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 /
Last active Mar 12, 2017
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.
EricRahm /
Last active Feb 6, 2020
Gecko Rust XML Parser Requirements

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


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


  • push/sax based interface (lower memory, streaming)
  • supports DTD, entities
EricRahm / .mozconfig
Created Dec 30, 2016
Example mozconfigs
View .mozconfig
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
export LD="/usr/bin/gold"
# For gcc-6.3.0
EricRahm /
Last active Jan 26, 2016
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
View example.cpp
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: