Skip to content
Whyphy Technologies
Insights

How we optimized a POS app for PAX A920 Pro?

How we reduced query time, memory leaks, nested UI rendering, and repeated data loading to make a POS app run faster on resource-constrained PAX A920 Pro terminals.

Jaykishan Dobariya4 min readPOSAndroidPerformance
Front, side, and back views of a PAX A920 Pro payment terminal

The Challenge

PAX A920 Pro devices are widely used as fully integrated POS devices. The device is very convenient due to its wide adoption by processors and gateways, and it is reliable for pay-at-the-table operations.

The PAX A920 mainly comes with two memory options: 2 GB RAM and 1 GB RAM, paired with dual-core, octa-core, and quad-core processors.

Having a fully fledged POS running on a PAX A920 24x7 is a challenge in itself because of the limited memory available.

The client had multiple users complaining about the slowness of the POS during operations such as:

  1. Menu navigation
  2. Payment processing
  3. Data syncing between multiple devices.

The situation becomes worse when the battery level drops below 20%.

The Analysis

We decided to start addressing these slowness issues. We first analysed the complete situation and shortlisted all the issues causing lag and high resource usage.

We used Android Studio’s built-in Performance Monitoring Tools to identify the memory bottlenecks. So far, we have found several areas for improvement:

  1. Slow queries
  2. Memory leaks
  3. Nested UI elements
  4. Caching and reduced mapping

We’ll discuss each point in detail.

The Solution

Infographic summarizing the four performance improvements used to optimize the PAX A920 Pro POS app.

1. Slow queries

We identified that several queries were written in a way that caused higher processor usage on PAX devices. Since the A920 Pro devices, especially the dual-core ones, do not have very powerful processors, it was important to reduce query-processing time.

We identified query execution times using Android Studio’s Database Inspector.

We were not able to identify this bottleneck earlier because all the latest hardware and desktop POS terminals come with good quad-core processors. Hence, they process queries faster without any visible delays. These types of issues are only visible when you test with resource-constrained devices.

After identifying the slow queries, we started eliminating loops and mappings. We restructured the data models in our domain layer and eliminated as many loops as we could.

This reduced query-processing time and significantly lowered processor usage, making those resources available for UI rendering and eventually making overall menu navigation faster.

Android Studio Database Inspector showing the POS app's database queries.

2. Memory leaks

LeakCanary showing detected memory leaks and their reference paths on an Android device.

Memory leaks are the silent killers. Developers often make the mistake of not checking for memory leaks in the early stages, and as the codebase grows, the problem keeps growing.

To understand what a memory leak is, imagine a variable where you’re storing something. This is initialised when you open a screen; take the menu screen as an example. Then, if you haven’t cleared the value of this variable when the screen closes, every time you revisit the menu screen, it keeps creating new variables while the old ones remain stale.

Over time, these stale variables keep consuming RAM, eventually resulting in a RAM shortage for the entire POS app. The app starts lagging after a couple of days of use.

Usually, wait staff and managers don’t close or restart a POS app every morning. They clock in, use it, and clock out—that’s it. The app stays open on the terminal 24x7. Hence, identifying and fixing memory leaks in a POS app is crucial.

We used tools like Leak Canary and Profiler to identify and fix such memory leaks. This process took the most effort of all the steps, and the impact of these fixes was higher as well.

We then automated this process to run automatically on our CI pipeline after every merge into the develop branch. We open-sourced the Memory Leak Check Skill as well.

3. Nested UI Elements

Android System Trace highlighting UI rendering and frame timing.

Nesting UI elements causes huge rendering delays in Android, eventually resulting in frame-rate drops that make the app feel laggier.

One example of such nesting is having a list inside another list. This requires nested adapters for the nested list. Android then has to draw a list for every list item in the parent list.

This type of multiple nesting results in slow rendering.

Using the Profiler tool in Android Studio, we were able to find such nested UI-element bottlenecks and fix them more effectively using ConstraintLayout and Jetpack Compose.

We tried to flatten the entire UI hierarchy to a single level and reduce nesting as much as possible, which resulted in multifold improvements in UI navigation.

4. Caching and reduced mapping

Caching is a very important way to reduce the repeated loading of images and data models.

To improve item loading on the menu screen, we cached the images in local storage and reused them directly instead of loading the same images from the network every time during menu navigation.

We also cached the entire menu, including category-, item-, and modifier-level data models, in an ArrayList and a Map instead of querying the database during every navigation. This helped reduce rendering delays and made overall menu navigation snappier and quicker.

The result

All this resulted in a massive performance jump for PAX A920 Pro devices and resolved almost all the complaints from wait staff and managers about slow menu navigation. As a cherry on top, it improved battery performance after these optimisations as well.

The Testimonial

Here’s what our client has to say about the way we managed and maintained the POS app across multiple platforms for both semi-integration and full integration.

David Lopez testimonial about the PAX A920 Pro POS project.

Let's build the software that moves you forward.

Tell us where your business is stuck. We'll show you what an AI-native team can ship, and how fast.