News for hackers. Stuff that matters.
Re:Taking PHP Seriously by pcwalton on Thursday October 13, 2016 @06:23PM (#12704607)
It may seem that way at first, but space leaks during individual requests are way too easy otherwise. Think about something as simple as, say, parsing Mustache templates. The parser is probably internally making lots of little substrings to record the names of directives as it comes to them. You would think that this is O(1) in space, since you only need one (or a small number) of strings at a time, but without a GC the space requirements balloon to O(size of input). Being able to dump the memory at the end of a request doesn't help you if you keep blowing out your cache during each one.

I speak from experience: there have been many attempts to mandatorily delay collection until the end of the event loop in browsers, to achieve greater responsiveness. It has always failed. You can add heuristics to try to preferentially collect at the end of the event loop, but you really need to be able to GC anytime.

Re:Taking PHP Seriously by tracker1 on Thursday October 13, 2016 @06:40PM (#12704748)
I'm not completely disagreeing... I've worked on pipeline transformers in node where I exposed gc and ran it after each item in the pipeline was done. It would grow insane without it... likewise I can see that if you're transforming a lot of records for delivery in PHP it could bloat as well.

However, if you're handling requests well within a given memory threshold, it isn't always something you should worry about until it becomes a problem. In which case, you'll probably want to look at something like go, rust, erlang or others to handle improvements, or break off heavy parts into sub/micro-services.

Re:Taking PHP Seriously by captn3m0 on Friday October 14, 2016 @06:25AM (#12707150)
for the specific case of templating: you wouldn't want to parse mustache in production, and use a pre-compiled template.