python英文文献_python_to_go英文文献资料.pdf

作者从2006年开始使用Python,曾在PyCon China 2013担任演讲者,但在去年转向了Go语言。尽管仍然喜欢Python,但现在他将Python用于爱好项目,而将Go用于需要高性能和高质量代码的项目。Go语言的速度得益于其异步、编译和多核支持。相比之下,Python的进程间通信慢,存在网络延迟、内存复制和解析等问题。Go的编译时错误处理也优于Python的运行时错误处理。对于关注性能的开发者来说,Go是一个值得考虑的选择。
摘要由CSDN通过智能技术生成

Why I switch from

python to Go?

weng.wei@

About Myself

• Coding python since 2006

• Speaker @ PyCon China 2013

• Architect @

• /Wuvist

• Switching to Go last year

“Switching”

• Before:

• Love Python

• python for all projects

• After:

• Still love python

• python for hobby projects

• go for serious projects

“Serious Projects”

• Performance is critical

• Code Quality is important

• OK, mostly web projects

Performance

• /benchmarks/

Do you use pypy?

“benchmark could be very misleading”

Stress test on real Go API

Requests/sec: 18071.20

Transfer/sec: 1.19GB

• Just anything

• Can python?

• Can nginx?

Why Go is so fast?

• Async

• Compiled

• Multi-cores

Python

tornado tornado tornado tornado

nginx (4 workers)

nginx tornado

• Inter-process communication is slow

• network latency

• memory copy

• parsing

• Process overhead

Python

memcached

tornado tornado tornado tornado

nginx (4 workers)

Go

Go binary with GroupCache

/golang/groupcache

Performance

• Care abut performance? You must consider go

• http://blog.cloudfl/go-at-cloudflare

Code Quality

Error

• Python: scripting language

• deal with run-time errors

• Go: compiled language

• deal with compile-time errors

Exception Handling

/yinwang0/status/417899535344472065

Pyth

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值