当前位置:网站首页>Rust Versus Go(哪种是我的首选语言?)
Rust Versus Go(哪种是我的首选语言?)
2022-07-07 04:21:00 【西京刀客】
Rust Versus Go
原文链接: https://dormoshe.io/trending-news/rust-versus-go-52434
在从如下作者的书中学习了这些语言之后,我在过去的一年中一直在使用 Rust 和 Go。
Herbert Wolverson’s Hands-on Rust:
Ricardo Gerardi’s Powerful Command-Line Applications in Go:
一年来同事和同行都在问,Medium 文章和 Reddit Rust 和 Go 论坛中似乎出现的一个大问题是,“哪个更好?” 这个问题真的没有答案,因为它是一个很主观的决定。几乎所有这些文章和帖子都以“视情况而定”结尾。但鉴于工程师更喜欢绝对的决策,这并不是一个令人满意的答案。所以一个更好的问题是,“你更喜欢哪一个?” 在各种场景中使用这两种语言后,我的默认首选语言是……Go。
Why Go?
我不是系统程序员,我大部分时间都在从事与 DevOps 相关的工作。Go 是为 DevOps 设计的,这在 Docker、Grafana 和 Kubernetes 等所有以 DevOps 为中心的应用程序中都显而易见。我也没有耐心进行长时间的编译,只是发现构建失败是由于一些迟钝的错误,有时我需要几个小时才能弄清楚。正如那些读过我的新书或在最近的Changelog 播客中听我采访的人都知道的那样,我在家里使用 Raspberry Pi。尝试编译一个比“Hello, World!”更长的 Rust 应用程序 在Raspberry Pi上。如果幸运的话,假设没有出现编译错误,它将在一个小时或更长时间内完成。
**Go随身携带了每个可执行文件的嵌入式运行时,但是与编译速度和便携便利性的总体好处相比,它相对较小。**尽管两种语言都有着许多依赖,但最近几个月来,Rust已成为供应链攻击的更大目标,这可能是由于它在社区中越来越突出,因为它被接纳为Linux内核。像System76这样的公司还表示,他们打算使用Rust来构建Pop!OS desktop。
性能
在性能方面,我发现 - 对于我的微型项目,两者都表现相似。我不是在构建大规模的并行 PB 级架构,而是构建能够很好地完成一项特定任务的小型、稳定的程序。
如果想让事情保持简单并且不关心性能,那么 Python 脚本就可以了。但是,**如果想要更高的性能和一个相当小的原生可执行文件,那么 Go 是我的主要语言选择。**当然,该语言没有官方的 GUI 支持,但 Rust 也是如此。虽然两种语言都存在基于 Webkit 的 GUI 项目,但我对它们都没有足够的兴趣来学习它们。
命令行程序
实际上,由于其以终端为中心的输出的性质,这些语言让我重新发现了不臃肿的命令行迭代程序的乐趣和速度。例如,我在 Go 中编写了一个自定义 Twitter 客户端,它以不同颜色突出显示我关注的关键主题标签和人员,使我能够快速、直观地识别我的提要中感兴趣的帖子。它在后端使用 Redis 云,因此每次我运行 tw 时,它都会在我运行它的各种操作系统之间保持同步。我用 Go 写代码用了不到一个小时,甚至在我的 Pi Zero 上编译也用了不到几秒钟。虽然我曾想过用 Rust 重写它只是为了练习我的语言能力,但时间继续前进,一天只有这么多小时可以花在学习和实验上。
Rust 有机会吗?
如果当 Rust 可以将编译时间减少到更合理的时间,并在编译中断时提供更少愚蠢的错误消息时,我可能会重新评估我的主要语言选择。但就目前而言,当我需要快速创建和部署新程序时,Go 是我编码列表的首选。
边栏推荐
- 242. Bipartite graph determination
- Gslx680 touch screen driver source code analysis (gslx680. C)
- Write CPU yourself -- Chapter 9 -- learning notes
- L'externalisation a duré trois ans.
- [P2P] local packet capturing
- 【p2p】本地抓包
- The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?
- pytest+allure+jenkins环境--填坑完毕
- Mysql高低版本切换需要修改的配置5-8(此处以aicode为例)
- Solve could not find or load the QT platform plugin "xcb" in "
猜你喜欢

After the interview, the interviewer roast in the circle of friends

【Unity】物体做圆周运动的几个思路

Detailed explanation of uboot image generation process of Hisilicon chip (hi3516dv300)

idea添加类注释模板和方法模板

KBU1510-ASEMI电源专用15A整流桥KBU1510
![[experience sharing] how to expand the cloud service icon for Visio](/img/42/dba9f78f3fb2049dad8b343b0b36e5.png)
[experience sharing] how to expand the cloud service icon for Visio

1、 Go knowledge check and remedy + practical course notes youth training camp notes

一、Go知识查缺补漏+实战课程笔记 | 青训营笔记

海思芯片(hi3516dv300)uboot镜像生成过程详解
![[webrtc] m98 Screen and Window Collection](/img/b1/1ca13b6d3fdbf18ff5205ed5584eef.png)
[webrtc] m98 Screen and Window Collection
随机推荐
Robot technology innovation and practice old version outline
基于Flask搭建个人网站
《动手学深度学习》(四) -- 卷积神经网络 CNN
1140_ SiCp learning notes_ Use Newton's method to solve the square root
Common method signatures and meanings of Iterable, collection and list
How can a 35 year old programmer build a technological moat?
2022-07-06:以下go语言代码是否会panic?A:会;B:不会。 package main import “C“ func main() { var ch chan struct
How to reduce inventory with high concurrency on the Internet
Dynamics CRM server deployment - restore database prompt: the database is in use
Detailed explanation of uboot image generation process of Hisilicon chip (hi3516dv300)
Rxjs - observable doesn't complete when an error occurs - rxjs - observable doesn't complete when an error occurs
gslx680触摸屏驱动源码码分析(gslX680.c)
BGP experiment (1)
Make a bat file for cleaning system garbage
Tongda injection 0day
Idea add class annotation template and method template
After 95, the CV engineer posted the payroll and made up this. It's really fragrant
通信设备商,到底有哪些岗位?
海思芯片(hi3516dv300)uboot镜像生成过程详解
vus. Precautions for SSR requesting data in asyndata function