Performance Optimization of a programs and software is the process modifying a software system to make it work more efficiently and execute more rapidly.
Performance optimization is key in having an efficiently functional application and is done by monitoring and analyzing the performance of an application and identifying ways to improve it.
Performance optimization generally focuses on improving just one or two aspect of the system’s performance, e.g execution time, memory usage, disk space, bandwidth etc. This will usually require a trade-off where one aspect is implemented at the expense of others. For example increasing the size of cache improves run-time performance, but also increases the memory consumption.
Levels of Optimization
- The design of the system may be optimized to make best use of the available resources, given goals, and expected load.
- The architectural design of a system plays a major role and overwhelmingly affects the system’s performance.
- For example a system that is network latency can be optimized to minimize network requests, ideally making a single request rather than multiple requests.
Algorithms and Data Structures
- The algorithm and data structures plays a very key role and is crucial to the system’s performance.
- To ensure a system is optimized, we should make sure the algorithms are constant O(1), logarithmic O(log n), linear O(n), or log-linear O(n log n).
- Quadratic complexity algorithms O(n2) fail to scale
- Abstract data types are more efficient for system optimizations
Source code level
- On implementation of algorithms, the source code choices are also quite crucial on system optimization.
- Disabling un-required software features during the build process can effective in optimizing for specific processor models.
NB: Optimization often reduces readability and introduces codes or technologies that are used to improve performance, this may complicate the systems making them harder to maintain and debug, hence it is advised to perform optimization at the end of the development stage.
Client-side and server-side Optimization
Applications are a mixture of server-side and client-side code. Your application can have performance problems on either side and both need to be optimized.
Server-side relates to how long it takes to run on the server to execute requests. Optimizing the performance on the server generally revolves around optimizing things like database queries and other application dependencies.
Client-side Performance Optimization
Below are some ways to optimize performance on the client side
- Caching and Content Delivery Networks
- Examples of cdns; cloudflare, Amazon AWS, MaxCDN, Fastly e.t.c
2. Bundle and Minification
- Bundling files together and producing fewer files improves performance
- Minifying the files and removing all unnecessary characters e.g white spaces also improves performance
3. Optimizing image usage
- Most images can be optimized and made smaller
- Also if you are using several small icons it is better to just use Icon fonts eg. font awesome.
- Removing the duplicate code reduces the size of the files hence better performance.
5. Using a minimalistic styling Framework
- This helps with the styling aspect and as the styling framework has already been optimized and minified for better performance it should be effective in keeping the performance of your system optimal.