Remix.run Logo
77pt77 a day ago

As someone who is not a fan of npm/ts I must say I find this almost delusional.

TS is way better than PHP and node is much faster.

const_cast a day ago | parent [-]

TS type system is virtually identical to PHP - structurally typed, union types, etc. I don't know why people think PHP is untyped - it's not 5.4 anymore. The type system is very full featured.

The difference is TS has to be compiled, PHP doesn't. If we have to compile stuff we might as well use a more safe language like C#.

Also no, Node is not fast. I don't know why people think Node/JS is fast. JS has very poor performance characteristics and it can't be fixed because it's a factor of the language design - although, PHP has similar problems.

Chromium is very optimized, for specific scenarios. Its still a dynamically typed, garbage collected language - and optimizing a for loop in a play pretend medium blog doesn't change that.

77pt77 a day ago | parent [-]

> Also no, Node is not fast. I don't know why people think Node/JS is fast

Node is not fast. It's faster than PHP and that is very clear.

The most cursory search and hands on experience will tell you that.

const_cast 18 hours ago | parent [-]

I don't think Node is faster than PHP because you can pretty aggressively optimize PHP. Between opcache cache, hot interpreters, JIT, frankenphp...

Chromium optimizes JS, sure, but not for that use case. It optimizes it for the frontend. I'm sure a huge part of that is how fast you can compile it - which means less aggressive optimize. I'm sure chromium absolutely does not optimize for long-lived JS processes.

Although, to be fair, I don't actually know which is faster. Just based off of my own experience, JS has been shockingly slow, and PHP quick in production. But that could be React clouding my view.

All in all, JS and PHP are pretty similar. The same stuff that makes JS slow is the stuff that makes PHP slow. Its not like JS has some magic sauce to turn an interpreted dynamically typed language into a performant one.