Skip to content

Instantly share code, notes, and snippets.

View jridgewell's full-sized avatar
😬

Justin Ridgewell jridgewell

😬
  • New York, NY
  • 02:34 (UTC -05:00)
View GitHub Profile
@jridgewell
jridgewell / index.html
Last active November 1, 2024 21:11
Forming graph from arrays: regular vs frozen (https://jsbench.github.io/#f65d3bfcf64177fc34044f8f67ff2a1d) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Forming graph from arrays: regular vs frozen</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 November 1, 2024 19:12
Forming graph from arrays: regular vs frozen (https://jsbench.github.io/#7802fbd8f3d46d7fef9d6009e65fd4bd) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Forming graph from arrays: regular vs frozen</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 / flatten.ts
Last active February 12, 2024 05:15
Flatten unobservable AsyncContext.Variable values from all living snapshot chains
/**
* Flattens all "snapshots", removing unobservable nodes so they may free their
* values.
*
* "snapshots" here is all Snapshot instances, every created
* Generator/AsyncGenerator, every stored Job, etc.
*/
function flatten(snapshots: Snapshot[]) {
const current = new Map<Variable>();
const maybe = new Map<LinkNode, LinkNode>();
@jridgewell
jridgewell / index.html
Last active February 9, 2024 09:00
encodeInto with subarrays vs offsets (https://jsbench.github.io/#f7ee4cec9df6f49e404d44ca8d5d3de8) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>encodeInto with subarrays vs offsets</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 / string-raw.md
Last active February 7, 2024 23:18
String.raw can't represent all strings

For reference, the only things that can't be represented in with String.raw are:

  1. Backslash as last char
    • String.raw`\` is a syntax error, it thinks you're escaping the closing `.
    • String.raw`\\` will output \\, not \.
  2. Interpolation sigils anywhere
    • String.raw`${` is another syntax error, it thinks you're trying to interpolate but you don't have the expression and closing }.
    • String.raw`\${` and String.raw`$\{` both contain a backslash in the output
  3. Backticks anywhere – String.raw``` is another syntax error, that's actually 2 tagged template literals with the second one missing its closing `.
  • String.raw`\`` contains a backslash in the output.
@jridgewell
jridgewell / index.html
Last active December 15, 2023 22:03
Source Map encode with TypedArrays (https://jsbench.github.io/#94c46cc814cab852a54aef37c56d59c4) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Source Map encode with TypedArrays</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 December 15, 2023 21:43
Source Map encode with TypedArrays #jsbench #jsperf (https://jsbench.github.io/#9cf1800a21b25e7cc0af56649178b174) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Source Map encode with TypedArrays #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 / id.pub
Created June 10, 2023 08:51
ssh key
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKuRIXMhWHFjn/F8N+vb7szhzf5vqwVxLCkO3bcLIr8PgbwmUcOfSgH4IJJG3Mi4qgWCVRwKZFnvH5MQ9LHdles= ID@secretive.Dandy.local
@jridgewell
jridgewell / index.html
Created August 11, 2022 23:40
Class Fields vs This Assignment vs Object.defineProperty(this) (https://jsbench.github.io/#659bbd90bd6534565ecd10a4721d1565) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Class Fields vs This Assignment vs Object.defineProperty(this)</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 August 1, 2022 21:29
String.replace vs RegExp.exec loop (https://jsbench.github.io/#0f971d52c8a86eb2c3e5983f5e8ebd0a) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>String.replace vs RegExp.exec loop</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>