Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Whereby fast is "About half the speed of native PHP"


Author here. Faster than it has ever been in the Edge via WebAssembly :)

But you are completely right pointing out that there's still some room to improve, specially when compared to running PHP natively.

Right now there's some price to pay for the isolation and sandboxing, but we are working hard to reduce the gap to zero. Stay tuned for more updates on this front!


Hey you should really check out fly.io if you want to run stuff on the edge. They have it pretty much figured out.

FrankenPHP is also really good and probably a much smarter play than trying to get your code running under WebAssembly.


Given that we run PHP on the edge, what is the point of running the PHP interpreter on top of a WebAssembly interpreter (Wasmer) instead of just running the PHP interpreter directly?

The latter will always be faster.


From what I can tell it's because some of these "edge" service providers will expect you to give them a WASM binary instead of a PHP script.

The other caveats about "edge" throughout this discussion aside, if I needed to do this, I'd try to write something in Zig or (gag) JS or something else that compiles to WASM directly rather than writing a script for an interpreter that runs under WASM.


Is this tech meant for developers' needs only, or can regular, already existing PHP websites (e-shops...) somehow take advantage of it as well?


It's meant for direct usage, not just for developers.

You can deploy apps on the Wasmer Edge cloud, and also host things yourself if you want to, though in the later case the setup will be non-trivial.


Nb PHP is already really fast. Some major things built on it are slow, mostly due to things like poor data access patterns or architecture, but its culture since the beginning has basically been “get out of PHP and into C as fast as possible” and it shows (this is basically the trick to any scripting language “being fast”, PHP just embraced it hard from the very beginning).

If you’re on PHP and need more speed in the language itself, basically every other scripting language (yes, including Node) is off the table immediately. Lateral move at best.

(All that to say, yeah, I entirely expected that the headline would lead to an article about making PHP slower)


> PHP just embraced it hard from the very beginning

Which is also the reason why a lot of the PHP standard library functions are so inconsistent. They're straight wrappers around the C libraries.

Upside is, unless you have to do shit with pointer magic or play around the edges of signed/unsigned numbers, it's fairly easy to port C example code for any of the myriad things PHP has bindings to to PHP.


I don't know which hype is worse, AI or WebAssembly on the server.


Is JS on the server still a thing?


Yes, and to use alternatives there is no need for WebAssembly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: