Skip to content

Instantly share code, notes, and snippets.

View jridgewell's full-sized avatar
😬

Justin Ridgewell jridgewell

😬
  • New York, NY
  • 01:26 (UTC -05:00)
View GitHub Profile
@jridgewell
jridgewell / index.html
Last active April 30, 2020 22:03
Subclassing custom elements (https://jsbench.github.io/#9554bc2ae3e2234ba0b2e0bd11fc755f) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Subclassing custom elements</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<style>
body {
font-size: 20px;
}
@jridgewell
jridgewell / index.html
Created March 11, 2020 22:04
Grabbing first part of a string (http://jsbench.github.io/#94a5176ad6fb86ed7aaeca9b9e08af53) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Grabbing first part of a string</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@jridgewell
jridgewell / index.html
Last active January 25, 2020 08:30
Fastest limited size lookup of integers (base64 lookup) #jsbench #jsperf (https://jsbench.github.io/#f5a12ed2e457ae2f8b9a874736e54ee0) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Fastest limited size lookup of integers (base64 lookup) #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Looping over a string</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@jridgewell
jridgewell / index.html
Created January 23, 2020 03:46
Searching strings for any of two special chars (https://jsbench.github.io/#31bf76ea5fa539b60fb1b80b321916d3) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Searching strings for any of two special chars</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@jridgewell
jridgewell / test.js
Last active December 3, 2019 23:49
Non-writable super-super prototype descriptor with TypedArraySet
"use strict";
const o = { __proto__: new Int32Array(10) };
Object.defineProperty(Object.prototype, 1.3, {
value: 42,
writable: false,
});
o[1.3] = 1; // Does this throw?
// If it does, then set finds the Object.prototype[1.3] PropertyDescriptor
@jridgewell
jridgewell / index.html
Last active October 23, 2019 05:40
Removing nodes from a parent #jsbench #jsperf (https://jsbench.github.io/#7251ec1d4edb2fdab8f0d748671613f1) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Removing nodes from a parent #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@jridgewell
jridgewell / weakmap.js
Created October 18, 2019 19:35
WeakMap implemented via Chrome's internal PrivateSymbol
class WeakMap {
#WeakMapData = %CreatePrivateSymbol('[[WeakMapData]]');
delete(key) {
const sym = this.#WeakMapData;
if (!%HasProperty(key, sym)) {
return false;
}
delete key[sym];
return true;
@jridgewell
jridgewell / index.html
Last active October 5, 2019 04:32
Summing rest vs var args (https://jsbench.github.io/#be658e0459613a031c01c1df83aca059) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Summing rest vs var args</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@jridgewell
jridgewell / index.html
Created October 2, 2019 18:22
Directive Implementations: WeakMap vs Property vs Private Symbol (https://jsbench.github.io/#df58ced0052eb86792b2e996615ac5cc) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Directive Implementations: WeakMap vs Property vs Private Symbol</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>