Instantly share code, notes, and snippets.

View behaviours.md

Strategies for Corner Cases (using integer overflow for examples)

  • Defined Behaviour: all implementations must behave exactly like this!

    • Defined to a usually-unhelpful, but perhaps common, behaviour (wrap on overflow)

    • Defined to usually-desired, but perhaps expensive, behaviour (provide infinite precision)

View log.txt
This file has been truncated, but you can view the full file.
Log that leads to crash, problematic things
old: 0 547 320 175
new: 56 547 264 175
mInvalidRect only stretches to fit new, and not old, indicating:
InvalidateRect(aData->mRect.Intersect(mImageBounds));
is being messed up by mImageBounds being too small
View dump.txt
dirty rect: Box2d { x1: 56, y1: 4, x2: 1236, y2: 726 }
old:
Box2d { x1: 56, y1: 4, x2: 1236, y2: 726 } *
Box2d { x1: 651, y1: 60, x2: 721, y2: 216 } *
Box2d { x1: 715, y1: 182, x2: 759, y2: 207 } *
Box2d { x1: 700, y1: 157, x2: 741, y2: 194 } *
Box2d { x1: 689, y1: 78, x2: 798, y2: 175 } *
Box2d { x1: 835, y1: 260, x2: 849, y2: 278 } *
Box2d { x1: 767, y1: 282, x2: 834, y2: 336 } *
Box2d { x1: 838, y1: 258, x2: 849, y2: 266 } *
View subtyping2.md

Subtyping and Variance

Subtyping is a relationship between types that allows statically typed languages to be a bit more flexible and permissive.

Subtyping in Rust is a bit different from subtyping in other languages. This leads to examples of subtyping being a bit convoluted. This is especially unforunate because subtyping, and especially variance, are actually really hard to understand properly. As in, even compiler writers mess it up all the time.

View selection-proposal.md

----- Problem -----

When running the display list painting code, we have each item in the display list individually lookup all the live selections and try to determine if its frame is selected. This code (nsRange::IsNodeSelected) is really expensive. Expensive enough that doing this for every display item takes seconds on pages with lots of sibling nodes (such as 1000 comma seperated links). In this case I believe we take ~O(n^2) time computing selections, where n is the number of nodes in the DOM.

Mostly this isn't a problem for gecko because we have display item invalidation, letting us skip this work on nodes outside the range of the selection. However webrender has no such feature, and as such becomes incredibly unresponsive (checkerboarding due to rendering at ~0.2 fps).

Adding more caching to this code has improved it a lot, but we're still orders of magnitude off of where we need to be.

View WIP.md

% Notes on Type Layouts and ABIs in Rust

Alexis Beingessner

October 9th, 2018 -- Rust Nightly 1.30.0

Over the years I've found myself with a weird amount of knowledge about how types and ABIs in Rust work, and I wanted to write it all down in one place so that... it's written down in one place. Much of this information can or should be found in the [Rust Language Reference][reference] and the [Rustonomicon][nomicon].

Special thanks to Nicole Mazzuca for doing tons of fact-checking on this one!

View rawtraitobjs.md

Raw Trait Objects 1.0

This is the sketch of a proposal for making it possible to manipulate some trait objects in stable rust.

Proposed new/stabilized API:

mod std::raw {
View patch.diff
diff --git a/gfx/webrender/src/glyph_rasterizer/no_pathfinder.rs b/gfx/webrender/src/glyph_rasterizer/no_pathfinder.rs
index abdc2a7736f8..b75ae10cd293 100644
--- a/gfx/webrender/src/glyph_rasterizer/no_pathfinder.rs
+++ b/gfx/webrender/src/glyph_rasterizer/no_pathfinder.rs
@@ -5,7 +5,7 @@
//! Module only available when pathfinder is deactivated when webrender is
//! compiled regularly (i.e. any configuration without feature = "pathfinder")
-use api::{ImageData, ImageDescriptor, ImageFormat};
+use api::{DirtyRect, ImageData, ImageDescriptor, ImageFormat};
View motionmark-in-firefox.md

Properly Running MotionMark On Firefox

TL;DR: to get accurate/useful numbers for MotionMark in Firefox you must set these flags in about:config and restart your browser:

layers.offmainthreadcomposition.frame-rate = 0 (defaults to -1)
privacy.reduceTimerPrecision = false (defaults to true)

The first enables "ASAP mode" which tells the browser to paint frames as much as possible, and the second disables an important Spectre security mitigation that reduces the precision.

View patch.diff
diff --git a/gfx/webrender/src/display_list_flattener.rs b/gfx/webrender/src/display_list_flattener.rs
index 525e79e837e2..3498892e1139 100644
--- a/gfx/webrender/src/display_list_flattener.rs
+++ b/gfx/webrender/src/display_list_flattener.rs
@@ -1029,6 +1029,15 @@ impl<'a> DisplayListFlattener<'a> {
None
};
+ let mut ancestor_is_backface_visible = is_backface_visible;
+ for sc in self.sc_stack.iter().rev() {