HipHop Your Way To PHP

A few days ago facebook released (under opensource) their HipHop for PHP source code transformer. I remember first reading about this from an interview with a facebook employee on reddit. She mentioned that one guy was pretty much rewriting PHP to work on C++, which at the time sounded like they were working on some compiler. The actual product though is different, they basically convert the PHP source into C++ code, and then you can use your compiler of choice (probably g++) to get it up and running. I know something about this area as my final year project at uni I created a code transformer that would take a web script in PHP -> JSP -> ASP and convert it into any of the others. You could basically go in any direction – plus you could add in new modules for other languages that would allow you to transfer between even more. This was far from completion (I had it working for about 50% of common functionality) but I proved that it could be done – I also showed that you could optimize the code quite significantly. I basically added rules that would find common coding patterns and transform these in the AST (abstract syntax tree). Transforming to the new language was relatively easy as the tree was already in a good shape and the transformer knew how to properly express the tree in the most optimized way. The way I see it – HipHop has the opportunity to not only transform but optimize the hell out of the code as well. They say that in practice they are seeing a 50% CPU decrease and much better memory overhead.

I believe that the current version is compatible with PHP5.1 and they are quickly looking to get it compatible with 5.2. There are also some bits that it wont do, such as the rarely used eval() statement and function exists checking – these are things that they cant link to as they don’t know they exist, therefore can’t compile against

I have always liked PHP and have watched it get better and better to the point of it being a very professional tool in the right hands. I still regularly use PHP for my own applications that I need to get out the door quickly and effciently. What makes this interesting to me is that I can also look at it as a tool of choice for applications where I wouldn’t have before used PHP. I will have to play with it a bit and see what it can do. I think it will get more interesting when they get a version that can run on Apache/lighttd etc.

Go and get the code for yourself and check out the video for further information.

For more information on the technical challenges they face scaling Facebook, take a look at this article which goes into a deep enough description.

Very Cool Real Life Halflife Game

Want Some Guice? Yes Please..

I don’t know if you guys ever watch the Google IO presentations but if you don’t you should because sometimes you find a gem. Guice is one of those gems. Guice is a lightweight Java dependency injection framework (not another one I hear you cry) but it does look very interesting. Take a look at the video if you have time.

Those of you that read this blog regularly will know that I have been moaning about Java web development for a while because it takes more time setting stuff up than it does actually coding the thing and it puts me off. I have been threatening the world that I would be working on my own framework but I now may not have to because Guice actually seems to have most of the things that I was looking for. I am going to take a further look and see if their are any more cool things or any concerns.

It fits well with the new Java app engine api as you would expect and the very cool thing I liked is GWT with GIN that can actually compile your modules/injections to Javascript so that they can be used to write the client side interface. I found that rather cool. There are a few pieces missing such as the ability to compile down method injections but in the video they confirmed this is coming soon. I now think that the app engine has finally reached the stage where I would be interested in releasing apps onto it and would recommend it to others. Yeah there are plenty of concerns about data privacy but the same can be said with any cloud environment and especially one that is hosted in the USA. As far as I see it, as long as your app is not storing data critical to national safety I don’t see a problem :)

So, I am currently setting it up, will write an app, release it onto the app engine and write something about it here with any insights I may have.

Cool Text Images

Google Wave

I have been taking a look at Google Wave and it looks very interesting. I am interested in taking a look but will most likely never get the time to. I bet some really cool things will be done with it. It’s not such a leap forward as they would like you to think but it is very cool and cleverly well done. I might get around to writing a bot because they can’t be that hard compared to writing your own wave system. The cool thing is that the client was all written using Google Web Toolkit (GWT) and they doubted that they would have been able to do it using anything else. It just goes to show the actual power of using GWT. People seem to be getting confused about it though having read other reviews and twitter traffic. It is not a service but a protocol and it is open source. The system they were showing was their implementation of the protocol.

It makes me laugh that the crowd has been shouting out that Google should buy Twitter over the last months, but I can see now why they havn’t been bothered. They had this under wrap for some time now and it has the capability of being pretty big. It is a very good collaboration, wiki, communication and loads of other stuff system because it is extensible and an open protocol. It will be interesting when multiple implementations are connected to each other and data is shared between multiple systems. You are also able to write services for it from the App Engine so it will be interesting to see the power of apps that you will be able to create using just their tools and infrastructure.

Spotify On Android – Very Cool!

Changing To New Host (MediaTemple)

Just to let you know that I now have my new media temple account opened and I have changed the DNS over to the new one. You will know when it has changed over because this post will not exist and there will be a new one also saying that it has completed. Unless you get there before I manage to write a new post that is.