Scott Meyers wants to bring default zero-initialization to C++, mentions TDPL for precedent
deadalnix via Digitalmars-d
digitalmars-d at puremagic.com
Sat Nov 21 14:47:45 PST 2015
On Saturday, 21 November 2015 at 11:40:41 UTC, John Colvin wrote:
>> Actually, that's not surprising, Rasmus Ledorf is a specialist
>> of the web, while he doesn't knows much about PL both
>> theoretically and practically (by his own admission). As a
>> result, you get a passable language, but you know what ?
>> That's not the important part.
>
> Could you elaborate a bit on this? What about the execution
> model is so right?
PHP runs every request in complete isolation. All global/static
are in fact request local storage. This has many consequences,
namely:
- It scales. More machines, more requests.
- It makes memory management easier: everything is reference
counted, and if you leak because of cycles, it doesn't matter,
you trash it all at the end of the request.
- Because of builtin reference count, you can get efficient COW
containers. PHP array are weird, but they get that right.
- Because you have COW containers, you can shared them accross
request without fear of screwing everything up. Useful for
configurations or other data structures that doesn't change often.
- Because you get fresh environment for each request, it is much
easier to debug when something goes wrong.
- If something goes bad for one request (out of memory, takes
too long to run, ...) you can trash it without any risk of
impacting the service at large.
- When a request corrupt its state for whatever reason, you
don't put the whole service in jeopardy. Log and trash it all.
Amazingly, most other tools to do the same do not share this
design decision, and it has quite a negative impact. Python with
things like django has the GIL, Java and C# have locking all over
the place in its standard lib, Node.js mixup all requests int he
same context and play the callback game, which put the whole
service at the mercy of one request going sour, and will cause
major issues when scaling. I have to say, even vibe.d doesn't get
this right.
Obviously alternatives have other selling points, but overall,
there is nothing like PHP to serve web request at a massive scale
and this is why so many big websites are using it.
More information about the Digitalmars-d
mailing list