Wednesday, 8 October 2014

Monkeys and Humans

Fig 1. A (cheeky) monkey
For some people, it's easier to make sense of just what a monkey is if we assume that all a monkey is ever trying to do is be a human. That if it could just lose the hair and walk upright, we could give it a bank account, job, car, and the rest of it; they'd fit right in.

Since HHVM became a thing, there has been this kind of attitude, that somehow Zend is now behind, and that it should strive to be HHVM; lose the hairy bits and it will fit right in.

Monkeys and humans make perfectly good livings, just the way they are, as are Zend and HHVM.

In recent months Zend has got extremely profitable gains, not by introducing a Just-in-Time capable engine, but by aggressively refactoring the Zend engine, introducing better conventions with regard to memory usage, and as a result of that, better API's; it's paying off, extremely well. These changes will be in the wild when PHP "7" is released.

I want to encourage people to think differently about where to take Zend next; the world is better off with monkeys and humans.

Zend is a complicated animal, but its got nothing on HHVM; the introduction of JIT capabilities at the level of the engine will probably bite us in the ass.

I understand the attraction of running code directly on the CPU, I understand that even while most of us don't need it, none the less, we want our code to be as fast as physics and the engineering of the day will allow.

There is another way, a much less intrusive, more productive way.

Not very long ago, after some late night conversations and bar room programming, Anthony Ferrara (@ircmaxell) and I came upon the idea to be able to compile those bits of your code you know are very slow to machine code, in userland; I set about exposing libjit to userland and JITFu was born, Anthony set about writing the frontend compiler and Recki-CT was born.

Today Recki-CT is able to generate machine code (using JITFu) and C; this means you can turn a limited subset of the PHP language into machine code at runtime, or into a pecl extension as part of your deployment process.

The beauty of Recki-CT is that it is entirely written in PHP, so many more people can be involved in the development.

The community is quite brilliant at solving problems; for nearly every problem that is solved in the core, there is a better solution in the wild. There is now no reason to approach the problem of making your code fast differently, what Recki-CT is doing is putting the power at your fingertips.

If you have even a faint interest, I encourage you to get involved, checkout Recki-CT and start reading.