While PHP is an excellent language for building complex web application, it imposes certain limitations. Writing code that performs low-level, computationally intensive tasks in PHP is generally impractical--it'd simply be too slow. The QB extension addresses this particular weakness of PHP. By translating Zend opcodes and executing them through a statically typed virtual machine, QB offers an order-of-magnitude gain in performance. The added power allows PHP programmers do things they were unable to do before, such a complex, pixel-level image manipulation.
In this article, we'll construct a filter that reduces an image to grayscale except for the part where it's red. It's a relatively simple effect that can produce some striking results.
The Free Transform > Distort tool in Photoshop lets you freely move the four corners of an image. It's useful for doing things like perspective correction. This article shows how to replicate the effect using QB.
In my discussions with PHP developers about QB, a topic that inevitably comes up is HipHop. Although QB is designed to handle a different set of problems than that faced by HipHop, it’s natural enough for people to want to know how the two perform relatively to each other. After all, they are both some sort of accelerators for PHP. In this article, I’ll run some tests to see how QB fares vis-à-vis HipHop.
Following the convention used by Pixel Bender (which in turn follows GLSL), QB stores matrices in column-major order. The expression $m means the first column on the third row. This can be really confusing since C (whose syntax PHP mimicks) uses the opposite convention. It's especially so when you're initializing a matrix with literal values.
One modern technique compilers like gcc use to improve performance of code they generate is Profile Guided Optimization (PGO). Normally, compilers perform optimization without knowing how a program will behave when it actually runs. Codes that are frequently used are treated no differently from codes that run only rarely. PGO gives compilers additional insights on a program's dynamic, so they can make more efficent use of available resources. In this article, we'll investigate what impact PGO has on QB.
QB does not have built-in capability of compiling functions to native code. It relies on an external C compiler. On Linux, it uses gcc. On Mac OSX, it uses either gcc-llvm. On Windows, it uses Microsoft Visual C++.
After months of hard work, the next version of QB is finally ready. Version 1.4 addresses a couple serious shortcomings in version 1.3. It also brings a host of new features.
Page 1 of 3