magicdawn 最近的时间轴更新
magicdawn
ONLINE

magicdawn

V2EX 第 63811 号会员,加入于 2014-05-28 23:47:26 +08:00
iOS 15 Developer Beta 太卡了, 发热, 掉电贼快
Apple  •  magicdawn  •  2021 年 6 月 21 日  •  最后回复来自 aero99
19
clash-config-manager clashX 配置管理.
分享创造  •  magicdawn  •  2020 年 10 月 1 日  •  最后回复来自 magicdawn
7
bj-hospital-vis 北京-医保定点医院-可视化
分享创造  •  magicdawn  •  2021 年 5 月 7 日  •  最后回复来自 liangchen1ce
21
[北京] 滴滴出行招聘前端实习生
酷工作  •  magicdawn  •  2018 年 3 月 10 日  •  最后回复来自 magicdawn
5
APNs 正确的姿势是啥
iDev  •  magicdawn  •  2016 年 12 月 16 日  •  最后回复来自 lokig
12
V8 Release 5.4
Node.js  •  magicdawn  •  2016 年 9 月 10 日  •  最后回复来自 magicdawn
4
pyenv 真是个好东西
Python  •  magicdawn  •  2016 年 6 月 13 日  •  最后回复来自 whnzy
22
magicdawn 最近回复了
3 月 30 日
回复了 uni 创建的主题 Node.js npmmirror 竟然有些包没有更新到最新版本
@uni #9 为什么不去了解一下背景呢?大 npm 包被影视站利用,成本你出么?

如果你嫌弃就不要用,没有收费为何要承担被你喷的困境。

是的你没有了解背景的义务,但同时你也没有喷的权利。
3 月 29 日
回复了 uni 创建的主题 Node.js npmmirror 竟然有些包没有更新到最新版本
npmmirror v.s tencent mirror ,坐标湖北武汉, 结果:

=== Final Result (sorted by tarball avg) ===

npmmirror
metadata avg: 229.4 ms
metadata p50: 253.9 ms
metadata p90: 409.2 ms
tarball avg: 435.1 ms
tarball p50: 266.1 ms
tarball p90: 906.1 ms


tencent
metadata avg: 777.0 ms
metadata p50: 700.7 ms
metadata p90: 1336.7 ms
tarball avg: 508.6 ms
tarball p50: 440.9 ms
tarball p90: 938.3 ms

脚本 via ChatGPT
```js
#!/usr/bin/env node
import { performance } from 'node:perf_hooks'

const registries = [
{
name: 'npmmirror',
base: 'https://registry.npmmirror.com',
},
{
name: 'tencent',
base: 'http://mirrors.tencent.com/npm',
},
]

// 👉 多包(覆盖不同大小 & 热门程度)
const PACKAGES = [
{ name: 'react', version: '18.2.0' },
{ name: 'lodash', version: '4.17.21' },
{ name: 'typescript', version: '5.4.5' },
{ name: 'axios', version: '1.6.7' },
]

// 👉 多轮(建议 ≥10 )
const RUNS = 10

// 👉 并发数(模拟 npm )
const CONCURRENCY = 4

async function fetchWithTiming(url) {
const start = performance.now()
const res = await fetch(url)
await res.arrayBuffer()
return performance.now() - start
}

// 简单并发控制
async function runPool(tasks, limit) {
const results = []
let i = 0

async function worker() {
while (i < tasks.length) {
const idx = i++
results[idx] = await tasks[idx]()
}
}

await Promise.all(Array.from({ length: limit }, worker))
return results
}

async function testRegistry(registry) {
const metadataTimes = []
const tarballTimes = []

for (let run = 0; run < RUNS; run++) {
const tasks = []

for (const pkg of PACKAGES) {
const metadataUrl = `${registry.base}/${pkg.name}`
const tarballUrl = `${registry.base}/${pkg.name}/-/${pkg.name}-${pkg.version}.tgz`

tasks.push(async () => {
const t = await fetchWithTiming(metadataUrl)
metadataTimes.push(t)
})

tasks.push(async () => {
const t = await fetchWithTiming(tarballUrl)
tarballTimes.push(t)
})
}

await runPool(tasks, CONCURRENCY)
console.log(`[${registry.name}] run ${run + 1}/${RUNS} done`)
}

function stats(arr) {
const sorted = [...arr].sort((a, b) => a - b)
const avg = arr.reduce((a, b) => a + b, 0) / arr.length
const p50 = sorted[Math.floor(sorted.length * 0.5)]
const p90 = sorted[Math.floor(sorted.length * 0.9)]
return { avg, p50, p90 }
}

return {
name: registry.name,
metadata: stats(metadataTimes),
tarball: stats(tarballTimes),
}
}

async function main() {
const results = []

for (const r of registries) {
console.log(`\nTesting ${r.name}...`)
const res = await testRegistry(r)
results.push(res)
}

console.log('\n=== Final Result (sorted by tarball avg) ===')

results.sort((a, b) => a.tarball.avg - b.tarball.avg)

for (const r of results) {
console.log(`
${r.name}
metadata avg: ${r.metadata.avg.toFixed(1)} ms
metadata p50: ${r.metadata.p50.toFixed(1)} ms
metadata p90: ${r.metadata.p90.toFixed(1)} ms
tarball avg: ${r.tarball.avg.toFixed(1)} ms
tarball p50: ${r.tarball.p50.toFixed(1)} ms
tarball p90: ${r.tarball.p90.toFixed(1)} ms
`)
}
}

main()
```
3 月 29 日
回复了 uni 创建的主题 Node.js npmmirror 竟然有些包没有更新到最新版本


这个包水平低下,严重浪费开发者磁盘,建议停用
https://www.npmjs.com/package/effect-solutions?activeTab=code
3 月 29 日
回复了 uni 创建的主题 Node.js npmmirror 竟然有些包没有更新到最新版本
这是个公益站,恶心不用就是。没有收你一分钱哦~
因为我觉得很好,必须站出来说句好
因为 npmmirror 我的常用命令 `corepack use pnpm@latest && ncu-safe && pi && p dedupe && p prune` 快了不少

export COREPACK_NPM_REGISTRY=https://registry.npmmirror.com


```sh
❯ where ncu-safe
ncu-safe: aliased to ncu -t minor -u

❯ where pi
pi: aliased to pnpm install

❯ where p
p: aliased to pnpm
```
3 月 29 日
回复了 uni 创建的主题 Node.js npmmirror 竟然有些包没有更新到最新版本
确实烦,但是一个包 325MB 就不得不反思为什么 npm 包要这么大?
npm 应该用来分发代码, assets 请自建分发,参考 puppeteer 下载浏览器实例.

> 325793115 / 1000 / 1000
325.793115
发 ncr 的没毛病,OP 描述有问题。
ncr 是防止访问 google.com 重定向到 google.com.hk ,ncr = no country redirection.
OP 的标题让人想到这个。

OP 想说的是 safari 浏览器搜索引擎选择谷歌时,safari 内置的是 google.cn ,这是个中间页问你要不要到 google.com.hk 上搜索,想要看到结果必须再点一下链接。
这个锅只能 safari / Apple 背,ipad 上搜索引擎这几个预设选项,没有自定义,还不修正 google.cn 的行为。
@hpan #20

https://developer.mozilla.org/en-US/docs/Web/API/File_System_API
只能说 web 无所不能...

webgpu webusb ...
2025 年 12 月 7 日
回复了 SayHelloHi 创建的主题 分享发现 轻量级 macOS Clash 菜单栏客户端
type=select 的 proxy-group 怎么处理的
需要开 dashboard 选么?
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   5795 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 33ms · UTC 03:00 · PVG 11:00 · LAX 20:00 · JFK 23:00
♥ Do have faith in what you're doing.