编程语言与软件工程2021arxiv.org
让 GNU Emacs 支持原生代码 (2020)
Bringing GNU Emacs to Native Code (2020)
进阶 · 约 45 分钟读完前置知识:Emacs Lisp、编译器基础、C 语言
导读
这篇论文介绍如何为 GNU Emacs 引入原生代码编译(native-comp,又称 gccemacs):把 Emacs Lisp 编译成机器码,以获得明显的执行性能提升。HN 评论显示该分支后来合并进 trunk 并成为默认配置,实际使用稳定,但编译 Emacs 本身会慢 3–4 倍。
HN 关注点:Emacs 原生编译带来的实际提速、合并进主线的进展,以及编译成本和后续 GC 等性能瓶颈。
后来怎么样
native-comp 已并入 GNU Emacs 主线,成为 Emacs 28 以后的重要构建特性,显著提升 Lisp 执行性能,并改变了发行版与用户编译、缓存和分发 Lisp 包的方式。
HN 评论精选
这几条评论里:支持 1 亲历 3
亲历实际使用稳定且提速明显,代价是自编译 Emacs 更慢。
加速非常明显。和其他人一样,我已经用 Emacs 的 native-comp 分支好几个月了,没有遇到任何问题。现在它已合并到 trunk,并将成为默认配置。我看到的唯一缺点是编译 native-comp 分支时,编译 Emacs 本身要花 3 到 4 倍时间。
TacticalCoder查看英文原文
The speedup is very noticeable. Like others I'm running the "native-comp" branch of Emacs, since months, without any issue. It's now been merged into trunk and it's going to be the default: https://news.ycombinator.com/item?id=26935401 The only drawback I saw is that compiling Emacs itself takes 3x to 4x longer when compiling the native-comp branch.
支持native-comp 是重大进步,下一步应改进 GC 和内存分配以释放更多性能。
我认为 nativecomp 是 Emacs 的一大飞跃。我一直感谢 Andrea Corallo 和整个团队让这成为可能。我认为 Emacs 的下一次大飞跃需要涉及垃圾回收器和分配逻辑。我认为改进 GC 后可以实现一大类性能优化,包括改善 Emacs 现有的线程能力。
DDSDev查看英文原文
I think that nativecomp represents a huge leap forward for emacs. I continually give kudos to Andrea Corallo and the entire team for making this a possibility. I think that the next major leap for emacs needs to involve the garbage collector and allocation logic. I think that a large class of performance optimizations would be possible with an improved GC, including improvements to emacs existing threading capabilities.
亲历长期跨平台使用体验很好,并提供了 Nix 相关配置和资料。
gccemacs 太棒了!我在 macOS 和 NixOS 上用了超过一年,体验极佳(不过我会时不时清理下载的包和 native 缓存以防万一)。这绝对也是工程上的壮举。如果你没看过开发者关于它的网站,一定要看看。macOS 上的 Nix 用户有专门配置,这是我在 home-manager 配置中的用法;Linux 和 NixOS 的 Nix 用户可看 Emacs overlay,那里甚至有 Emacs nativecomp + Wayland 支持(emacsPgtkGcc)。
siraben查看英文原文
gccemacs is amazing! I've been using for more than a year on macOS and NixOS, and it's been superb (though from time to time I clear downloaded packages and the native cache just in case). It's definitely an impressive feat of engineering as well. If you haven't seen the developer's website on it[0], you should definitely check it out. For Nix users on macOS, see[1]. Here's how I used it in my home-manager config[2]. For Nix users on Linux and NixOS, see the Emacs overlay[3]. There's even Emacs nativecomp + wayland support (emacsPgtkGcc) there. [0] https://akrl.sdf.org/gccemacs.html [1] https://github.com/twlz0ne/nix-gccemacs-darwin [2] https://github.com/siraben/dotfiles/blob/8161e1b72965b48f8223fd4624554ebae20d7ce4/home-manager/.config/nixpkgs/home.nix#L23 [3] https://github.com/nix-community/emacs-overlay
亲历实际游戏/渲染性能也有提升。
现在在 Emacs 里玩 Doom 的帧率好多了。
rcakebread查看英文原文
Getting much better fps in Doom in Emacs now.
相关资源
从这篇论文所有 HN 讨论帖的全部评论里整理出来的链接。
历次讨论
- 2021Hacker News 讨论帖369 分 · 130 评
同领域还值得读
Google 的软件工程(2017)
Software Engineering at Google (2017)
介绍了 Google 的软件工程实践,包括其单一代码库(monorepo)、几乎全部开发在主干进行而非分支、代码审查、构建系统 Blaze、协议缓冲区等工具与流程,并讨论了频繁重…
编程语言与软件工程2017 · 1,127 分 · 465 评 · 引用 15入门 · 约 45 分钟编辑精选Peter Naur:编程作为理论构建 (1985)
Peter Naur – Programming as Theory Building (1985)
Peter Naur 1985 年的经典论文《Programming as Theory Building》提出:编程的本质不是写代码或文档,而是在程序员头脑中构建对程序及其运行…
编程语言与软件工程2016 · 629 分 · 74 评入门 · 约 45 分钟编辑精选SciPy 1.0:Python 科学计算的基础算法
SciPy 1.0: fundamental algorithms for scientific computing in Python
这篇发表于 Nature Methods 的论文介绍了 SciPy 1.0——Python 科学计算生态的基石库,涵盖其核心算法模块(优化、积分、插值、线性代数等)、软件架构与社…
编程语言与软件工程2020 · 387 分 · 98 评入门 · 约 45 分钟编辑精选Lisp 的历史(1979)
History of Lisp (1979)
这是 Lisp 发明者 John McCarthy 于 1979 年为 HOPL(编程语言史)会议撰写的回顾文章,讲述 Lisp 的起源、设计动机与早期演进,文中也涉及 if 表…
编程语言与软件工程2018 · 352 分 · 44 评入门 · 约 45 分钟编辑精选使用 NumPy 进行数组编程
Array Programming with NumPy
这篇 Nature 文章介绍 NumPy 的数组编程模型及其在科学计算中的核心作用:以 ndarray 为中心,通过向量化操作让 Python 高效处理多维数组。
编程语言与软件工程2020 · 318 分 · 134 评入门 · 约 40 分钟编辑精选