Hardware Info:
ProductName: Mac OS XProductVersion: 10.13.3BuildVersion: 17D47Model Name: MacBook ProModel Identifier: MacBookPro14,2Processor Name: Intel Core i5Processor Speed: 3.1 GHzNumber of Processors: 1Total Number of Cores: 2L2 Cache (per Core): 256 KBL3 Cache: 4 MBMemory: 16 GB
Benchmark 代码: https://github.com/Brooooooklyn/sourcemap-decoder/blob/master/benchmark/index.js
因魏每次调用 Rust 的代码会有一次 bootstrap 的过程以及 JavaScript 代码在运行很多次后会被 JIT 优化,在一次性运行几万次的情况下差距可能缩小为十几倍,有兴趣大年夜家可以自行测验测验。
CI/CD
刚写完计算上线的时刻,想让 production 的镜像尽量小一点(我们用的 Docker),所以直接在 Production 的 Image 上用了 node:8-alpine 作为 base image,响应的,CI 的镜像(我们应用的是 Gitlab runner 的 Docker executor )也是用同样的 base image,然后花了三个多小时测验测验在 Alpine 上安装 latest rust toolchains 后掉败了,最后不得不忍耐 100 多 m 的体积差切换到了 node:8-slim
。最终的国内可以流畅 build 的 Dockerfile 在 https://github.com/Brooooooklyn/sourcemap-decoder/blob/master/Dockerfile
Toolschains 安装
因为众所周知的原因,CI 在刚开端 build image 的时刻异常的迟缓,直到超时被 Gitlab kill 掉落,经由一个多小时倔强的抵抗后将所有可能撞墙的步调全部调换成了 USTC 的 mirror。
主如果 dev 机械 rustup 安装须要:
最后会将这些处理后的信息输出到阿里云的 LogHub。
curl https://sh.rustup.rs -sSf | sed "s/https:\/\/static.rust-lang.org\/rustup\/dist/https:\/\/mirrors.ustc.edu.cn\/rust-static\/rustup\/dist/g" | sh
应用 USTC 的源安装 Rustup
build 前须要:
cat > $HOME/.cargo/config << EOF[source.crates-io]registry = "https://github.com/rust-lang/crates.io-index"WordStr-with = 'ustc'[source.ustc]registry = "git://mirrors.ustc.edu.cn/crates.io-index"EOF
让 Cargo 也是用 UTSC 的源(CI 情况也须要履行同样的敕令)
详情请参考 README
在 CI 的 Docker Image build 的时刻须要 调换 Rust 下载源 以及 调换 Rustup源
【编辑推荐】
- 一个前端法度榜样员的一个月原生 Android 开辟体验
- 主动 Import 对象,前端打字员的自我救赎
- 2018 前端趋势:更一致,更简单
- 为前端而生!2018年1月超实用前端干货大年夜合集!
- 厉害了!神经收集替你写前端代码
推荐阅读
年前最后一场技巧盛宴 | 1.27与京东、日记易、假贷宝技巧大年夜咖畅聊智能化运维成长趋势! 这几天来,我(Eric Raymond)在思虑那些正在挑衅C说话的体系编程说话领心肠位的新潮说话,尤其>>>详细阅读
地址:http://www.17bianji.com/lsqh/40443.html
1/2 1