Skip to content

Instantly share code, notes, and snippets.

View Yoric's full-sized avatar

David Teller Yoric

View GitHub Profile
@Yoric
Yoric / Context 0.1 performance.md
Last active September 10, 2019 16:56
Context 0.1 performance

Benchmarking Context 0.1

Baseline

  • strcmp in table read
  • O(entries) lookup in Huffman tables

Unit tests

@Yoric
Yoric / lookup.md
Last active September 6, 2019 14:12
Faster Huffman lookup

We currently use the slowest Huffman lookup ever. Let's fix this :)

Replacing (bits, bitLength) with just a key.

We're currently using a mapping (bits, bitLength) -> value. We can, however, turn this into a mapping paddedBits -> (bitLength, value).

Consider the following Huffman table

Symbol | Binary Code | Int value of Code | Bit Length

@Yoric
Yoric / compression.csv
Created January 29, 2019 17:47
Compressing tests/data/facebook/single/*.js with optimal dictionary: streams
File raw (b) brotli-compressed (b) compression
floats.content 437,222 154,644 35%
identifier_names.content 4,911,852 1,220,574 25%
list_lengths.content 1,985,534 540,598 27%
property_keys.content 2,785,813 1,348,434 48%
string_literals.content 3,100,358 1,494,151 48%
unsigned_longs.content 448,663 90,978 20%
floats.prelude 13,817 10,907 79%
identifier_names.prelude 2,907 1,896 65%
identifier_names_len.prelude 1,012 277 27%
@Yoric
Yoric / compression.md
Created November 15, 2018 16:00
Recent compression numbers

Facebook snapshot:

  • minified, decompressed: 42Mb;
  • minifed, brotli-compressed (max compression): 9Mb;
  • entropy
    • non-optimized dictionary, decompressed: 13Mb;
    • non-optimized dictionary, compressed with brotli: 1.9Mb;
    • minified, entropy-compressed: 6.9Mb

Two notes about the non-optimized dictionary:

@Yoric
Yoric / Errors.log
Created October 1, 2018 09:19
Errors in safe mode (which works)
While registering XPCOM module <static module>, trying to re-register CID '{95790842-75a0-430d-98bf-f5ce3788ea6d}' already registered by <static module>.
Bootstrapped manifest not allowed to use 'resource' directive. chrome.manifest:2
Error: WebGL warning: getContext: Disallowing antialiased backbuffers due to blacklisting. Troubleshoot.jsm:470:18
Error: WebGL warning: <SetDimensions>: Failed to create WebGL context: WebGL is currently disabled. Troubleshoot.jsm:470:18
Error: WebGL warning: getContext: Disallowing antialiased backbuffers due to blacklisting. Troubleshoot.jsm:470:18
Error: WebGL warning: <SetDimensions>: Failed to create WebGL context: WebGL is currently disabled. Troubleshoot.jsm:470:18
NS_ERROR_XPC_GS_RETURNED_FAILURE: Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]
@Yoric
Yoric / Errors.log
Created October 1, 2018 09:06
Errors without addons
While registering XPCOM module <static module>, trying to re-register CID '{95790842-75a0-430d-98bf-f5ce3788ea6d}' already registered by <static module>.
Bootstrapped manifest not allowed to use 'resource' directive. chrome.manifest:2
OpenGL compositor Initialized Succesfully.
Version: 2.1 ATI-1.68.20
Vendor: ATI Technologies Inc.
Renderer: AMD Radeon Pro 560 OpenGL Engine
FBO Texture Target: TEXTURE_2D
The resource from “https://www.netflix.com/ichnaea/cl2/freeform/WebsiteDetect?source=wwwhead&fetchType=css&modalView=title” was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff).[Learn More]
MediaKeySystemAccess::GetKeySystemStatus(com.widevine.alpha) result=available msg=''
Failed to get service worker registration(s): Storage access is restricted in this context due to user settings or private browsing mode. 80002612:103:4
@Yoric
Yoric / Errors.log
Created October 1, 2018 08:59
Error logs
Successfully compiled asm.js code (total compilation time 0ms; not stored in cache (too small to benefit)) adblockplus.js
InvalidStateError: RTCPeerConnection is gone (did you enter Offline mode?) background.js:113
[bug 1345098] Lazy browser prematurely inserted via 'messageManager' property access:
getter@chrome://browser/content/tabbrowser.js:2020:37
getAllFrames@chrome://extensions/content/parent/ext-webNavigation.js:192:15
call/result</<@resource://gre/modules/ExtensionParent.jsm:948:49
withPendingBrowser@resource://gre/modules/ExtensionParent.jsm:602:26
async*call/result<@resource://gre/modules/ExtensionParent.jsm:947:16
withTiming@resource://gre/modules/ExtensionParent.jsm:908:14
interface EagerFunctionDeclaration : Node {
attribute FunctionDeclarationPrologue prologue;
attribute FunctionDeclarationContents data;
};
interface SkippableFunctionDeclaration : Node {
attribute FunctionDeclarationPrologue prologue;
[Skippable] attribute FunctionDeclarationContents data;
};
# Before
-rw-r--r-- 1 dteller wheel 170K May 21 15:02 angular.1.6.5.binjs
-rw-r--r-- 1 dteller wheel 71K May 21 15:02 angular.1.6.5.binjs.gz
-rw-r--r-- 1 dteller wheel 4.7K May 21 15:02 angular.1.6.5.bools
-rw-r--r-- 1 dteller wheel 114B May 21 15:02 angular.1.6.5.bools.gz
-rw-r--r-- 1 dteller wheel 8.7K May 21 15:02 angular.1.6.5.declarations
-rw-r--r-- 1 dteller wheel 2.2K May 21 15:02 angular.1.6.5.declarations.gz
-rw-r--r-- 1 dteller wheel 1.1K May 21 15:02 angular.1.6.5.dict.grammar
@Yoric
Yoric / multistream+inner.csv
Created May 21, 2018 14:40
Namespace string enums
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
File, Source (b), Source+Gzip (b), Source+Brotli (b), Source+BZip2 (b), BinAST (b), BinAST/Source, BinAST+GZip (b), BinAST+GZip/Source+GZip, BinAST+GZip/BinAST, BinAST+Brotli (b), BinAST+Brotli/Source+Brotli, BinAST+Brotli/BinAST, BinAST+BZip2 (b), BinAST+BZip2/Source+BZip2, BinAST+BZip2/BinAST
"tests/data/frameworks/angular.1.6.5.min.js", 168517, 58770, 51589, 52328, 69152, 0.4103562251879632, 69184, 1.1771992513187, 1.000462748727441, 69157, 1.3405377115276513, 1.0000723044886626, 69698, 1.3319446567803088, 1.007895650161962
"tests/data/frameworks/backbone.1.3.3.min.js", 23355, 7576, 6861, 7231, 9794, 0.41935345750374653, 9757, 1.287882787750792, 0.9962221768429651, 9694, 1.4129135694505175, 0.9897896671431489, 10149, 1.4035403125432167, 1.0362466816418214
"tests/data/frameworks/bootstrap.4.1.0.min.js", 50676, 14016, 12202, 13247, 17050, 0.33645118004578106, 17010, 1.21361301369863, 0.9976539589442815, 16942, 1.388460908047861, 0.9936656891495601, 17412, 1.3144108099947158, 1.0212316715542522
"tests/data/fr