Сравнение PHP и NodeJS

Нашел интересную табличку по сравнению PHP и NodeJS для применения в веб-разработке.

Comparison (good, bad, solution)
Apache, PHPnode.js
syntaxAdditional language to web standard ECMA script
try to use common structures
One language to rule them all = reuse parts of your framework on the client side
‘line\nline’ or “line\n\
templates<code><?php // code ?></code>var s = ‘<code>’;
// code
s += ‘</code>’;
// send response
database interfacePDO + prepared Statements (includes class instance support)Still no prepared statements, 1.5 – 3x slower
Driver update
unicodePCREno Unicode Character Properties / Scripts / Blocks in RegExp (only \w, \W consider Unicode whitespace)
add chars manually to regexp
orderno namespaces up to 5.3
simple modules / namespaces
serving filesApache serves static filesOverhead to serve static files
Use additional webserver (nginx) or included in web framework
accessOnly synchronous access
… but easier code
Asynchronous access via closures
… highly nested code
OOPimplicit memoization via __get() and reuse of requested keygetters (/setters) must access key with other name, bad for iteration or JSON notation
platformmany reliable extensionsmany extensions still experimental
… but the community is dynamic
GIS functionalityrichjust stuff based on pointsfew
GIS standardsfull OpenGIS support (except for GeomColl in relational functions, workaround functions)no OpenGIS at all, just pointsfull excepting for GeomColl
GIS indexingno GeomColl
index single geoms
GIS performancefast

Отсюда можно сделать вывод, что некоторые высоконагруженные части проекта можно переписать на NodeJS, а лучше всего на C++ и подключить как модуль nodeJS. Пример сишной библиотеки написанной для нод, это HashLib.

Оригинал тут

Leave a Comment