Skip to content

Instantly share code, notes, and snippets.

View fabiospampinato's full-sized avatar

Fabio Spampinato fabiospampinato

View GitHub Profile
@fabiospampinato
fabiospampinato / monaco.js
Created July 24, 2020 21:15
monaco aggressive tokenization
This file has been truncated, but you can view the full file.
// The Monaco Editor can be easily created, given an
// empty container and an options literal.
// Two members of the literal are "value" and "language".
// The editor takes the full size of its container.
const WarAndPeace = `# 00 - A War and Peace
BOOK ONE: 1805
CHAPTER I
@fabiospampinato
fabiospampinato / gist:7d540c073f52372d96e3d43bb39885c1
Created July 21, 2020 16:07
indexOf performance issue on v8
This file has been truncated, but you can view the full file.
const bench = ( name, fn ) => {
console.time ( name );
fn ();
console.timeEnd ( name );
};
const run = () => {
const dumb = 'a'.repeat ( 4000000 ).replace ( /[\r\0]/g, '' ); // The seemingly useless regex here makes things go faster later on