Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

HHVM Blog:
LLVM Code Generation in HHVM
Oct 29, 2015 @ 17:08:22

In this post to the HHVM blog they answer a common question they get from the development community: why don't they use LLVM for code generation when compiling down the PHP.

The primary reason has always been that while LLVM is great at optimizing C, C++, Objective-C, and other similar statically-typed languages, PHP is dynamically typed. The kinds of optimizations that provide huge performance benefits for static languages tend to be less useful in dynamic languages, or at least overshadowed by all the dynamic dispatching that’s done based on runtime types. We knew that there was probably something to be gained from using LLVM as a backend, but there were many larger opportunities go after first.

They talk about the compilation pipeline HHVM uses and shows the difference between how it works versus how LLVM would integrate into the final steps. They also talk about the work put in to explore the use of LLVM IR and what kind of changes they had to make to support it. This includes updates to PHP function call handling, generalizing vasm and updates to the LLVM tool itself (with changes to location records, smashable calls and performance tweaks among others).

tagged: hhvm llvm code generation compilation changes updates support

Link: http://hhvm.com/blog/10205/llvm-code-generation-in-hhvm

Jacob Santos' Blog:
Would PHP benefit from JIT compilation?
Mar 27, 2007 @ 15:52:00

In this post from his blog, Jacob Santos asks the question "would PHP benefit from JIT compilation?"

JIT (just in time) compilation is, according to Wikipedia, a method for converting, at runtime, code from one format into another, for example bytecode into native machine code. To try to see the benefit of this, Jacob asks four questions in his post (each with their own problems):

  • Q: What advantage over opcode caching is gained?
    P: A JIT library that works with PHP would have to support all of the architectures that PHP can run on!
  • Q: Which JIT library is the best one?
    P: A JIT compiler is not going to achieve anything without either storing the results or caching them.
  • Q: Wouldn't writing PHP extensions negate the need for JIT compilation?
  • Q: When will I develop and release my implementation?
Check out the comments for some great thoughts from others about this kind of compilation.

tagged: jit compilation benefit question problem opcode support extension jit compilation benefit question problem opcode support extension

Link:

Jacob Santos' Blog:
Would PHP benefit from JIT compilation?
Mar 27, 2007 @ 15:52:00

In this post from his blog, Jacob Santos asks the question "would PHP benefit from JIT compilation?"

JIT (just in time) compilation is, according to Wikipedia, a method for converting, at runtime, code from one format into another, for example bytecode into native machine code. To try to see the benefit of this, Jacob asks four questions in his post (each with their own problems):

  • Q: What advantage over opcode caching is gained?
    P: A JIT library that works with PHP would have to support all of the architectures that PHP can run on!
  • Q: Which JIT library is the best one?
    P: A JIT compiler is not going to achieve anything without either storing the results or caching them.
  • Q: Wouldn't writing PHP extensions negate the need for JIT compilation?
  • Q: When will I develop and release my implementation?
Check out the comments for some great thoughts from others about this kind of compilation.

tagged: jit compilation benefit question problem opcode support extension jit compilation benefit question problem opcode support extension

Link:


Trending Topics: