大佬教程收集整理的这篇文章主要介绍了Golang vs Node.js: The Showdown,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
出处:http://www.polydaic.com/blog/go-vs-node-js
By David Baldwin Jan266:23:59 PM
Before Node.js popped on the scene,asyncwas something (primarily) used by OS developers - backend web devs had few (easy) options to implement async functionality into their code. But then Node.js came on the scene in 2009 and took the web development community (as well as networking devs) by storm. Since then Node.js has been thego totechnology for web apps needing high throughput and multiple sockets (e.g. web messaging).
However in 2012all changedwith the first stable release ofGolang; a open-sourced google backed language built withasyncandspeed. Golang,invented at Google byRobert Griesemer,Rob Pike,andKen Thompsonis a statically typed language that closely resembles C; but with useful features like type-safety,non-blocking io,dynamic typing and with fast compilation times.
Let's look the disadvantages and advantages of each stack and see how they addup in the 'real world':
Since this site primarily deals web technologies,we'll narrow our focus to just backend web development ( and leave out the limitless other types of applications we Could build).
First off Golang and NodeJS share similar features and technologies that power them. Both feature non-blocking io and are have dynamically cast types (no more type casting problems like C!)
Both also havefully featuredstandard libraries that support a multitude of functionalities,including HTTP and TCP (which can be access throughinterfaces in Goandmodulesin NodeJS).
OK. Thats great but your here to seewhich one is betterright? Well then take a look below for the advantages and disadvantages:
As seen below in the test results byJonathan Warnerdonehere,Golang can Now be considered a viable alternative to NodeJS. In hisbubble sortandhttptests,Golang came out on top. However it is to be noted that Go does randomly spike when handling plain HTTP requests compared to NodeJS,maknig me doubtfull on the scalability of these results.
Node.js | Go 1.1 | |
Avg of 5 trials | 430ms | 326.26ms |
Best | 420ms | 290.272ms |
However when the two techologies were subjected to a Redis bottleneck simulation,their performance gap siginficantly narrowed,making the difference between the two almost negligiable,as seen in the graph below (again done by Jonathan):
In summary I think its fair to say that at this point,what framework you use won't adversely affect your web app's performance. It really just comes down to whether you are willing to jump on a new technology before it is proven,or stay on the NodeJS train until you are comfortable. If you do want to code in Golang,take a look atthisfor more info.
Jan26
以上是大佬教程为你收集整理的Golang vs Node.js: The Showdown全部内容,希望文章能够帮你解决Golang vs Node.js: The Showdown所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。