The interest in Cyber-Physical Systems (CPSs) has increased recently. This does not only show in big companies, but also in the open-source community. In short, a CPS is an integration between a hardware (cyber) component, the environment (physical), and part of a larger computational environment (system). Under this category falls drones, self-driving cars, but also medical devices such as some pacemakers.
As CPSs are also real-time systems, the performance of the hardware and software has a direct impact on the outcome. A small calculation delay could cause a self-driving car to respond too slowly to avoid a deer on the road.
When we look at the software aspect of a system, one method of searching for potential performance issues is by searching for Software Performance Antipatterns (SPAs). Antipatterns are code patterns that we can detect that have a negative impact on the system. SPAs are a sub-type of antipatterns that describe the performance implications.
With this poster, I show how one type of SPA can cause a larger impact on the system’s overall performance. This antipattern is called the Magical Waiting Number (MWN).
The MWN antipattern refers to the lack of proper waiting time in the CPS when interacting with the hardware. When the CPS sends a request or invokes a module in the hardware, it needs to correctly estimate the time it takes for the hardware to finish the task and, if applicable, return the response. With this antipattern, the developer has used an incorrect waiting duration for the situation. These hardcoded waiting times do not consider the actual time it would take for the hardware to finish its task and are often guessed by the developer implementing the feature. The problem increases when the same module is used for more than one type of hardware. This results that the slowest hardware module will determine the waiting duration for all supported hardware. Resulting in losing any profit when upgrading to faster hardware.
As part of my research, 14 Open-Source projects, with different maturity and programming languages, were analyzed. From 52,318 commits, 1059 commits were selected based on performance-related keywords in their commit message. These 1059 commits showed it might contain a potential performance increase or decrease. From these 1059 commits, the MWN antipattern was found in 98 commits.