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