How to build blazingly fast applications

How to build blazingly fast applications

The aim of the developer is to increase the performance of the app and enhance user experience. Often time stands against the developers with the stakeholders breathing down their necks, competition threatening to bring out better apps than they can produce and users hinting to switch to competitor apps. So the project management teams are always on the lookout for methods that would help them build apps fast – blazingly fast. And yes, just fast is not enough. They have to concentrate on making these apps resilient, with low latency, and provide great rendering times.

Choosing the right tech stack

A tech stack is a set of programming languages, tools, technologies and software products that developers use to create a functional web app. This can be categorized as server side (back end) stack, client side (front end) stack and middle ware. Due to the large number of gem libraries, RoR is the most commonly used frameworks for fast app development. For example, if you are just starting out in your business, you can choose a language/framework/CMS tool that would let you put together a prototype. The tools with the shortest learning, the better would be for you.

Keep away from premature optimisation

Donald Knuth once said, “Premature Optimisation is the root of all evil”.

Developers spend a lot of time thinking about the non-critical parts of a software, rather than developing the critical parts of the code. They don’t give importance to the critical parts of the code, nor do they work on the code that needs to be optimised.

Inexperience could cause that. In order to prevent similar things from happening to your team, make sure the team writes the first version of the code without worrying about its performance. Later, by using a profiler, the team can check where the bottlenecks are situated.

This way they can check on areas that really need attention and not bother about what doesn’t.

On the PHP land, there are some tools that you can use to profile your code. They are xdebug, xhprof, Symphony profiler, Tideways, and The Stopwatch Component.

Do only what you need to do

Quite often your code does certain things that are beyond the realm of what you expected it to do. Especially when it comes using complex libraries and frameworks. Sometimes, you might load classes that you were not planning to use, or open a database connection which were not needed to generate results for a specific request.

You need to avoid these from happening because those could stand in the way of your performance. Here are a couple of tips on how you can achieve better performance:

a) Autoloading – With the help of the Autoloading feature, you need to bother only about those files that you needed to include in your script. It is true that Autoloading was a bit complex endeavour in the past, but with the help of tools like Composer and PSR-0 and PSR-4 standards, configuring auto loading a piece of cake.

b) Dependency injection – Though a very common design pattern in Java, Dependency Injection got a lot of traction in the world of PHP as well. This is because frameworks like Symphony, Laravel and Zend use it widely. Through Dependency Injection, developers can inject components through the constrictor method and enables the developer to think in terms of dependencies. This helps them to create small isolated components where the focus is on just one thing.


You can reduce the size of data by using compression techniques available for the content. REST services have lower overhead, and make sure the images in the data are sized correctly, because hard to load images can really affect the loading of apps. Also ensure that you have the HTTP compression turned on when you use with a web server.

Use the caching method to do repetitive tasks

There is no doubt that web apps are really complex these days, and they must be competent enough to generate response for every request that comes in. A smart way to do repetitive task is through caching. This is a widely used technique that can be found everywhere. In web programming, there are different levels of caching that you can use like the Byte Code Cache, Application cache, HTTP cache and Proxy cache. This can avoid excessive trip through content infrastructure and mobile network.

Content delivery network (CDN)

Reduce network latency, content pre-fetching, network routing optimisation and more through CDNs or Content Delivery Networks. These are can speed up your application considerably. Some of the most popularly used CDNs are Akamai, Edgecast, Limelight, Amazon CloudFront and even telecommunication firms like AT&T and Level3.

If the backend is a performance zapper

If you feel that the backend server takes up a lot of performance time, then configure the software structure in such a way that portability, expendability, changeability and scalability doesn’t affect the app performance. You will probably have to conduct an architecture assessment to determine which part of the app oozes out speed. If you are choosing a third-party service for this, then ensure you ask them all the right questions before hiring them.

Lazy loading of assets

On-demand or lazy loading assets can improve the performance of your web app. However, this mainly applies to the images. Lazy loading of images can result in faster loading time of your page,
reduce load on the server and reduce the memory usage in the browser. Lazy loading can be done through relevant plugins or extensions. Here is a plugin that will handle lazy loading of images for React – react-lazy-load.

Use array-ids when using DOM manipulation libraries

Using array-ids would be of major help in improving the performance of dynamic sites if you are using React, Angular, Ember or any other DOM manipulation library. Array-ids give indication to DOM manipulation engines when a certain node can be mapped to any particular element in the array. Without this feature, libraries destroy the existing nodes and create new ones, thereby impairing performance.

“Follow these tips, just focus on writing the right codes for your project, and you can achieve a great level of performance and scalability for your app”

  1. 6 Rules of thumb to build blazing fast web server applications
  2. Building blazingly fast Android apps / Bjorn Gruenwald

About the author: Reema works as Thought Leader at PHPBabu.

Leave a Comment