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

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

Comparison (good, bad, solution)
Apache, PHP node.js
syntax Additional 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
strings ‘line
line’
‘line\nline’ or “line\n\
line”
templates <code><?php // code ?></code> var s = ‘<code>’;
// code
s += ‘</code>’;
// send response
http://github.com/creationix/microtemplates
database interface PDO + prepared Statements (includes class instance support) Still no prepared statements, 1.5 – 3x slower
Driver update
performance faster
unicode PCRE no Unicode Character Properties / Scripts / Blocks in RegExp (only \w, \W consider Unicode whitespace)
add chars manually to regexp
order no namespaces up to 5.3
simple modules / namespaces
serving files Apache serves static files Overhead to serve static files
Use additional webserver (nginx) or included in web framework
access Only synchronous access
… but easier code
Asynchronous access via closures
… highly nested code
http://github.com/creationix/step
OOP implicit memoization via __get() and reuse of requested key getters (/setters) must access key with other name, bad for iteration or JSON notation
platform many reliable extensions many extensions still experimental
… but the community is dynamic
PostGIS/Postgres MongoDB CouchDB
GIS functionality rich just stuff based on points few
stable yes yes probably
GIS standards full OpenGIS support (except for GeomColl in relational functions, workaround functions) no OpenGIS at all, just points full excepting for GeomColl
GIS indexing no GeomColl
index single geoms
yes yes
GIS performance fast

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

Оригинал тут

Leave a Comment