您的位置:首页 > 大数据 > 人工智能

How naive it's to believe node.js good for IO but bad for Computation?

2014-06-30 04:49 471 查看
The single process and asynchronous callback of node.js makes a lot of web developers who only know script programing cry. These developers argued, complained then labeled node.js not suitable for computation. How naive they are!

Since none of interpreted languages(also those languages running on VM, such as C# and Java) are not fast enough to perform complex computation, the assert about node.js is good for io but bad for computation is completely wrong. The who expecting the computation
function should write their owns addons in C/C++, just like they did as same as JNI and COM. So, the saying that nodejs has great io but poor computation is a pseudo-proposition.

wAnother popular complain about computation blocking services means the developers don't understand the essential core of Node.js' asynchronous model and performance going first . They still stay in the Stone Age of synchronous programming because their
less mature brain can't write asynchronous code. They think high-performance programming is just multi-thread and unfortunately node.js runs with single progress. Poor script kids(who's only know cording in script languages)! They must not have written any
extension of native code, neither PHP nor Ruby, Java and C#. They probably don't know aio and iocp.

Here I won't review the basis concept of computer science. I will provide a design that can extend the node.js computing capability to make it support graphics processing, video decode/encode/playback and even face recognition.

The basic concept is treating the CPU cores as same as IO resources, with the help of multi-thread or aio library which have been well implemented by boost and stl. Using asynchronous callback to return processing states and result, we'll break the single
process barrier of node.js. By dispatching computation resources like file io or database query, node.js will act as a computing center very well.

I couldn't talk about the details any more because it's been used in my project. I think anyone who is better than script kids can implement it by himself. If you don't please learn more.

The design sounds great. But after all, you should know how to write addons with C/C++, and multithreaded/aio programming. Most script kids will sucks.

Let them cry!

;-)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐