Code Monkey home page Code Monkey logo

Comments (6)

ircmaxell avatar ircmaxell commented on July 21, 2024

I would just like to make one thing clear with this project. It is not intended to replace PHP. It is not intended to be a production implementation.

As far as the root questions: can it be used with Apache? Theoretically, we could build a FastCGI SAPI and use that to integrate with Apache. Shouldn't be too hard, just need to build it.

As far as opcodes: we do generate them. They differ slightly from the core opcodes, but they are generally close enough where we may be able to translate. But that's a bit off...

As far as compiling PHPPHP to C, I think that's out of the question. Even with HipHop (which doesn't compile to C/C++ anymore), the performance just wouldn't be there. The only way we could get even performance would be to introduce a JIT compiler in PHPPHP, and have it generate machine code for PHP code. But that's a TON of work, and may not even give us significant performance (depending on the intricacies of the VM it runs on top of)... But it's a possibility...

from phpphp.

mnapoli avatar mnapoli commented on July 21, 2024

Thank you for taking the time to answer.

First, I understand you don't intend to replace PHP, I know you both contribute to it and it wouldn't really make sense.

But theoretically speaking : regarding the PHPPHP opcodes, I figure after all they don't need to match PHP's opcodes. If you cache them, executing php code should be as fast as with PHPPHP as with PHP?

And then I don't understand the need for JIT compilation? If PHPPHP opcodes are generated "slowly" but cached, everything should be good?

from phpphp.

nikic avatar nikic commented on July 21, 2024

@mnapoli Generating opcodes and then loading them into PHP is something we could do, though it would be a good bit more complicated than what is done now. In particular we would have to use the exact structure of the current ops and also generate all the other additional structures, ranging from compiled and temporary variables to literals and caching slots. We'd have to get this into a binary format that can be imported somehow (e.g. using apc bindumps), which again isn't trivial, as we'd have to do stuff like pointer swizzling etc.

So yeah, it's possible, and maybe its even worth giving it a try. But it will need a good bit of work.

from phpphp.

mnapoli avatar mnapoli commented on July 21, 2024

@nikic Actually I meant (in my reply) to cache PHPPHP's opcodes (and never even bother to use PHP, well except for executing PHPPHP itself). Like having an APC for PHPPHP, so that PHPPHP parses php files only once.

Once php files are parsed, their opcodes are cached and reused for the next executions.

from phpphp.

nikic avatar nikic commented on July 21, 2024

@mnapoli Compilation time is really not a concern. The thing that makes PHPPHP slow is the fact that we need to run those opcodes, which is very very very slow. The only way to make it fast is to load them as actual PHP opcodes ;)

from phpphp.

mnapoli avatar mnapoli commented on July 21, 2024

@nikic Ahhh ok I thought those opcodes were really low level.

Thanks! (I guess I can close the issue now)

from phpphp.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.