$ deno bench set_bench.ts
Check file:///Users/nemo/repo/deno-playground/set_bench.ts
cpu: Apple M1 Pro
runtime: deno 1.45.2 (aarch64-apple-darwin)
file:///Users/nemo/repo/deno-playground/set_bench.ts
benchmark time (avg) iter/s (min … max) p75 p99 p995
---------------------------------------------------------------------- -----------------------------
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
INPUT=${1:-input.mp4} | |
OUTPUT=${2:-output.gif} | |
ffmpeg -i "$INPUT" -vf "fps=10,palettegen=max_colors=20:reserve_transparent=0" palette.png | |
ffmpeg -i "$INPUT" -i palette.png -filter_complex "fps=4,paletteuse" "$OUTPUT" -y | |
rm palette.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@main def main() = | |
val blockQuotes = '"'.toString * 3 | |
val text = """@main def main() = | |
val blockQuotes = '"'.toString * 3 | |
val text = %s | |
println(text.formatted(blockQuotes + text + blockQuotes))""" | |
println(text.formatted(blockQuotes + text + blockQuotes)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asfd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (const N of [10_000, 100_000, 1_000_000]) { | |
Deno.bench("Array.fill()", { group: `${N}`, baseline: true }, () => { | |
new Array(N).fill(0) | |
}) | |
Deno.bench("Array.from()", { group: `${N}` }, () => { | |
Array.from({ length: N }, () => 0) | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedRecordDot #-} | |
{-# LANGUAGE DuplicateRecordFields #-} | |
{-# LANGUAGE NoFieldSelectors #-} | |
import Data.List (intercalate) | |
mergeSort :: Ord a => [a] -> [a] | |
mergeSort [] = [] | |
mergeSort [x] = [x] | |
mergeSort xs = merge (mergeSort left) (mergeSort right) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Look ma, no build step</title> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script type="module" src="./main.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sync PR/revert인 경우 merge commit, 그 외에는 squash merge | |
* | |
* 의존성: [github cli](https://cli.github.com) | |
* 설치: gh alias set pr-merge '! deno run -A /스크립트가/있는/경로/gh-pr-merge.ts $@' | |
* | |
* @module | |
*/ | |
import $ from "jsr:@david/dax@^0.41.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const f = (g: (x: number) => number) => (x: number) => g(x) | |
Deno.bench("closure directly", { baseline: true }, () => { | |
const foo = [...Array(1000).keys()].map(f((x) => x + 1)) | |
}) | |
Deno.bench("closure indirectly", () => { | |
const g = f((x) => x + 1) | |
const foo = [...Array(1000).keys()].map(g) | |
}) |
NewerOlder