News for hackers. Stuff that matters.
Re:Taking PHP Seriously by leeoniya on Thursday October 13, 2016 @06:40PM (#12704747)
I can't tell you how much more "runtime state" exists in PHP than in say Java. In both cases you need to initialize some sort of security-aware context. Once you've eliminated parsing, disk i/o and compilation phases. You should be on pretty even ground of bytecode vs bytecode. Java has a Hotspot JIT, so it will probably win there. I think a JIT is coming to PHP as well since the architectural rework that went into PHP7.
Re:Taking PHP Seriously by bpicolo on Thursday October 13, 2016 @06:48PM (#12704791)
There's more too it than that though, yeah? Say you use a service that uses oauth2 authentication. You need to do a request to pull in a oauth token. If you lose all state between requests, you waste time re-fetching tokens.

In PHP, persisting this sort of thing between requests becomes a painful task instead of a triviality

Re:Taking PHP Seriously by stephenr on Friday October 14, 2016 @09:44AM (#12707991)
> In PHP, persisting this sort of thing between requests becomes a painful task instead of a triviality

apc_fetch/apc_store hardly seems painful.

Re:Taking PHP Seriously by bkanber on Thursday October 13, 2016 @07:15PM (#12704980)
Session cookies were basically invented for transient statefulness over HTTP.
Re:Taking PHP Seriously by bpicolo on Thursday October 13, 2016 @07:22PM (#12705018)
I'm not referring to per-user sorts of things. You can't cache those locally in a sane way in any language. I'm talking about what would usually be memoizable sorts of things.
Re:Taking PHP Seriously by bkanber on Thursday October 13, 2016 @07:46PM (#12705143)
There are memoization libraries for PHP but really it's just another cache implementation. Put it in RAM, put it on disk, put it in memcached or redis, I don't really see too much a difference between $cache->set($key, $value) in PHP vs cache[key] = value in node for instance.
Re:Taking PHP Seriously by leeoniya on Thursday October 13, 2016 @07:09PM (#12704939)
if you need to persist some data/state between requests, php has a mature memcached extension. it's a fast memory store, but i'm not certain of the security implications since i dont think it has any kind of built-in isolation.
Re:Taking PHP Seriously by bpicolo on Thursday October 13, 2016 @07:15PM (#12704978)
Sure, but that means I have to either run a memcached instance on every server (which I've actually had to do before just for the sake of PHP) or I have to make network calls for something I shouldn't have to, and then also do serialization/deserialization. That's fine for plenty of things, but certainly isn't optimal for all sorts of stuff.

Not to mention, all the other languages out there memcached just as well.

Re:Taking PHP Seriously by Klathmon on Thursday October 13, 2016 @07:04PM (#12704904)
But in most languages http requests should be stateless. Even in node or Java you should be hitting the db to pull that info anyway, as sharing the last info in the process leads to scaling issues as well as big problems if the application crashes.

The alternative is crazy sharding systems which are becoming more and more difficult as devices are less and less "static"