Skip to content

Instantly share code, notes, and snippets.

View stormslowly's full-sized avatar
🎯
Focusing

pshu stormslowly

🎯
Focusing
View GitHub Profile
@stormslowly
stormslowly / repro-native-watcher-crash.js
Created July 17, 2026 13:29
Repro: rspack NativeWatcher concurrent &mut race crash (<= 2.1.4, macOS FSEvents use-after-free)
// Repro for a concurrent `&mut` race in NativeWatcher (rspack <= 2.1.4).
//
// Usage:
// npm i @rspack/binding@2.1.4
// node repro-native-watcher-crash.js
//
// On macOS the process dies within a few iterations, typically with:
// NSInvalidArgumentException: -[OS_os_log addObject:]: unrecognized selector
// (use-after-free on notify's FSEvents watched-paths CFMutableArray).
// Debug builds instead hit tokio's `!curr.is_join_waker_set()` assertion.
@stormslowly
stormslowly / README.md
Created June 14, 2026 18:13
camino Utf8Path::hash benchmark + callgrind data (delegate to inner Path, ~2.1x fewer instructions)

Utf8Path::hash micro-benchmark (callgrind)

Benchmark backing the camino PR that delegates Utf8Path::hash to the wrapped std::path::Path instead of iterating self.components().

Today impl Hash for Utf8Path walks the std::path::Components iterator and hashes each component separately. The wrapped Path::hash does the same job in a single-pass byte scan and is already consistent with eq (which compares components), so delegating to it is both correct and cheaper.

@stormslowly
stormslowly / Cargo.toml
Created April 2, 2026 05:46
Repro: FSEvents stale event drain timing test
[package]
name = "fsevents-repro"
version = "0.1.0"
edition = "2021"
[dependencies]
notify = { version = "8", default-features = false, features = ["macos_fsevent"] }
tempfile = "3"
let path_win = Path::new("d:\\test\\index.js");
let path_posix = Path::new("d:/test/index.js");
assert_eq!(path_posix, path_win)
@stormslowly
stormslowly / overrides canary
Created September 12, 2025 03:14
pnpm Rspack overrides scripts
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -lt 1 ]]; then
echo "❌ 缺少参数: 请提供 canary 版本号"
# use as overrides-canary 1.5.4-canary-293975c9-20250911173900
echo "👉 用法: $0 <canary_version>"
exit 1
fi
version="$1"
@stormslowly
stormslowly / git-lswf
Created June 23, 2025 10:57
list workflow according to current github repo's branch
#!/usr/bin/env python3
import subprocess
import json
import os
def run(cmd):
return subprocess.check_output(cmd, shell=True, text=True).strip()
def main():
branch = run("git rev-parse --abbrev-ref HEAD")
@stormslowly
stormslowly / git-checks
Created June 23, 2025 10:45
extended git command to show PR checks status
#!/usr/bin/env python3
import subprocess
import json
import sys
import os
from collections import defaultdict
def run_cmd(cmd, capture=True):
result = subprocess.run(cmd, shell=True, capture_output=capture, text=True)
if result.returncode != 0:
@stormslowly
stormslowly / helper.js
Last active May 28, 2025 03:54
javascript promise trace helper
import { JavaScriptTracer } from "./trace";
import { randomUUID } from "crypto";
function withTracer<A extends any[], P>(
eventName: string,
fn: (...args: A) => Promise<P>
) {
return (...args: A) => {
let g = randomUUID();
@stormslowly
stormslowly / gist:bd99e62abdc8a979635beaa0c942e6c4
Created May 9, 2025 08:50
rspsack-input-system-benchmark
| Name | Base (nativeFS) | Current | Change |
| -------------------------------------------------------------------- | --------------- | --------------- | -------- |
| 10000_big_production-mode_disable-minimize + exec | 20.6 s ± 8.13 s | 21.1 s ± 7.65 s | +2.49 % |
| 10000_development-mode + exec | 1.1 s ± 11 ms | 1.55 s ± 51 ms | +41.91 % |
| 10000_development-mode_hmr + exec | 661 ms ± 3.7 ms | 659 ms ± 12 ms | -0.29 % |
| 10000_production-mode + exec | 1.76 s ± 24 ms | 2.24 s ± 36 ms | +27.51 % |
| arco-pro_development-mode + exec | 1.3 s ± 51 ms | 1.74 s ± 66 ms | +33.88 % |
| arco-pro_development-mode_hmr + exec | 376 ms ± 1.3 ms | 384 ms ± 2 ms | +2.20 % |
| arco-pro_production-mode + exec
function fn_r {
# $# 命令参数个数, $* 参数列表
if [ $# -eq 0 ]; then
SCRIPT=$(jq -r '.scripts | keys[]' package.json | \
fzf --preview-window=down:10%:wrap \
--no-mouse \
--preview 'jq -r --arg script {} ".scripts[\$script]" package.json')
if [ -n "$SCRIPT" ]; then
history -s "r $SCRIPT"
if command -v atuin >/dev/null 2>&1; then