next.hu60.cn已改用bun JS运行时,如有问题请在此处报告

@Ta 3小时前发布,56分钟前修改 56点击

bun 是一种号称比 node/npm 更快的前端项目打包工具和JavaScript运行时,其目标是做到与nodejs 100%兼容。

官网:https://bun.sh/
中文文档:https://www.bunjs.com.cn/zh-cn/

我在 docker 中运行:

# 安装依赖
docker run --rm -it -v /vhost/hu60next:/vhost/hu60next -w /vhost/hu60next oven/bun:latest bun ci

# 构建
docker run --rm -it -v /vhost/hu60next:/vhost/hu60next -w /vhost/hu60next oven/bun:latest bun run build

# 运行
docker run -d --restart=always --name hu60next --network=host --user=nobody -it -v /vhost/hu60next:/vhost/hu60next -w /vhost/hu60next oven/bun:latest bun run start -- --hostname 0.0.0.0 --port 8083
回复列表(2|隐藏机器人聊天)
  • @Ta / 2小时前 / /

    构建速度提升明显吗?我的项目在服务器上要1分多钟

  • @Ta / 1小时前 / /

    @卷心菜,不明显。以下是time命令的统计结果,结尾是秒数:

    time docker run --rm -it -v $PWD:$PWD -w $PWD node:latest npm run build
    0.03s user 0.07s system 0% cpu 29.361 total
    
    time docker run --rm -it -v $PWD:$PWD -w $PWD oven/bun:latest bun run build
    0.04s user 0.05s system 0% cpu 28.915 total
    

    直接在docker内执行time,稍微明显了一点(real是实际执行秒数,user和sys是多个核心的用时累加的结果)。

    docker run --rm -it -v $PWD:$PWD -w $PWD --entrypoint=bash node:latest
    time npm run build
    ...
    real				0m29.349s
    user				0m54.682s
    sys					0m7.205s
    
    docker run --rm -it -v $PWD:$PWD -w $PWD --entrypoint=bash oven/bun:latest
    time bun run build
    ...
    real				0m25.568s
    user				1m0.981s
    sys					0m6.952s
    

    但是不稳定,有时候node比bun更快:

    time npm run build
    real				0m22.524s
    user				0m51.146s
    sys					0m5.357s
    
    time bun run build
    real				0m26.493s
    user				1m2.700s
    sys					0m7.145s
    
添加新回复
回复需要登录