3 ms·
Maybe you were just half a decade before your time and the rest of us had to catch up. I worry the php community is losing or has lost some of the really smart
by ck2 14y ago
Maybe you were just half a decade before your time and the rest of us had to catch up.
I worry the php community is losing or has lost some of the really smart folks.
Suhosin (Stefan Esser) is also fading away without any updates to work with php 5.4 and that's really sad, especially considering the radical performance improvements and memory-use reductions found in 5.4 and 5.5 vs 5.2 - 5.3
- pbiggar 14y agoThe PHP internals community is quite a poisonous place, IMO. Its a community that destroyed itself by being hostile to everyone who wasn't one of them.
- dkhenry 14y agoI think that's a function of their inability to let go of their own work. The internals of PHP need a _complete_ overhaul to make PHP competitive on a speed/memory basis with the python and rubys of the world, but that would mean throwing away a lot of work by the current contributors and probably re-architecting things like zvals and internal opcode representation. That's something I don't think they are willing to do, and I don't know if there is enough community around the zend core to really get it done even if they wanted to.
- pbiggar 14y agoI wouldn't know if that's the reason, but totally agree that the internals need a total overhaul. The entire codebase was a complete mess - hacks built on hacks built on hacks. Each variable takes what - 96 bytes I think on 64bit machines? The opcodes are terrible. The interpreter dispatch is switch based, and funnily enough it doesn't matter because the rest of the engine is so slow (function dispatch in particular) that interpreter dispatch doesn't even matter. Disclaimer: I dont think I've looked at PHP source in 3 years, it might have changed significantly but I suspect it has not. I'd love to be corrected with some detail!
- haberman 14y agoWhat's wrong with switch based dispatch? Lua's dispatch is switch based, and it is the fastest mainstream bytecode-based VM out there last I checked.
- pbiggar 14y agoLua's dispatch wasn't chosen because it was the fastest. If you read their Lua5 paper, they discuss how they prioritized being portable ANSI C over speed. Indirect threading is the fastest simple technique, but you can do even better. See section 3.3 of http://www.cs.tcd.ie/publications/tech-reports/reports.07/TCD-CS-2007-49.pdf http://www.cs.tcd.ie/publications/tech-reports/reports.07/TC... for a discussion.
- haberman 14y agoIf you're giving up portability, you might as well go all the way and create a JIT. Techniques like what the paper calls "inline-threaded dispatch" seem of limited usefulness, since they give neither the speed of a JIT nor the portability of a bytecode VM. My main point was that switch()-based dispatch isn't that bad. I'm surprised that this recent literature distinguishes between switch dispatch and token-threaded dispatch, since as Mike Pall notes, "Tail-merging and CSE will happily join all these common tails of each instruction and generate a single dispatch point," so the goto-spaghetti of token-threaded dispatch is likely not even worth it. (http://article.gmane.org/gmane.comp.lang.lua.general/75426 http://article.gmane.org/gmane.comp.lang.lua.general/75426) > Indirect threading is the fastest simple technique I'm confused; the paper itself says: "However, because of a level of indirection, indirect-threaded dispatch is not be as efficient as direct-threaded dispatch." Even direct-threaded dispatch still results in an indirect branch for every VM instruction, it just tries to save a table lookup over token-threading. Ultimately the most common and practical dispatch techniques seem to boil down to either a single indirect branch or replicated indirect branches.
- sb 14y agoYou're not really "giving up" portability, only with ANSI C. For all architectures where GCC is available, its labels-as-values support will happily compile and hence give you a fully portable instruction dispatch. Regarding the threaded code: the literature seems to be horribly inconsistent in this regard. Token threaded code might actually refer to indirect-threaded code depending on what the author has read. I was actually quite surprised to read what "indirect threaded code" originally meant when I read Debaere and van Campenhout's 1990 book "Interpretation and Instruction Path co-processing". Regarding the effect of CSE & tail-merging: I have only seen GCC to do this once, by disabling basic block reordering (-fno-reorder-blocks, due to a so-called "software trace cache"), otherwise this has never happened to me. Since I have nothing but the highest respect for Mike Pall, I guess that he might have experienced this for Lua, which has--to the best of my knowledge--less than 40 instructions. I will try to verify this on the weekend.
- notJim 14y agoUhh, to the extent that it makes sense to compare speeds of programming languages, PHP is faster and uses less memory than both ruby and python in many or most cases: Python: http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=php&lang2=python3 http://shootout.alioth.debian.org/u64q/benchmark.php?test=al... Ruby: http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=php&lang2=yarv http://shootout.alioth.debian.org/u64q/benchmark.php?test=al...
- byroot 14y agoDid you looked at the source ? For example for the pidigits bench: The PHP version use the GM extension http://shootout.alioth.debian.org/u64q/program.php?test=pidigits&lang=php&id=2 http://shootout.alioth.debian.org/u64q/program.php?test=pidi... And Ruby do it in pure Ruby http://shootout.alioth.debian.org/u64q/program.php?test=pidigits&lang=yarv&id=3 http://shootout.alioth.debian.org/u64q/program.php?test=pidi... So basically it's a C vs Ruby benchmark. Many peoples complained on the forum, take a look. The Debian shootout is interesting, but don't take it as an absolute truth.
- pbiggar 14y agoThe Debian shootout has made some very questionable decisions, and the author has defended them by saying that you cant rely on the results. Which is definitely true.