Skip to content

Instantly share code, notes, and snippets.

Eric Rahm EricRahm

Block or report user

Report or block EricRahm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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:
EricRahm /
Last active Oct 5, 2015
Memory Reporter State

Currently two focuses:

  • GetReportsState: roughly the interprocess state, keeps track of which subprocesses need to callled / are running. This is only in the parent process.
  • CollectReportsState: intraprocess state, used in runnable, keeps track of which CollectReports calls are pending. This is in all processes and created in GetReportsForThisProcessExtended
  struct GetReportsState                                                                                               
    uint32_t                             mGeneration;                                                                  
    bool                                 mAnonymize;                                                                   
EricRahm / async_reporter.cpp
Created Aug 14, 2015
Example async memory reporting
View async_reporter.cpp
// pseudo-pythonish-cpp, whatever
total_reporters = len(reporters)
// this is on the main thread
for r in reporters:
main_thread_dispatch(new DoReportEvent(r));
You can’t perform that action at this time.