16 July 2025

Maximo Automation Scripts: performance tips from software engineer. 1st part.

With the coming of automation scripts, there was a possibility for a non-technical person to write code in Maximo and see the results immediately. Everybody could change something that was not possible with configuration and make it work. The thing that people sometimes forget is that when you start to write code, you need to take care of it as code. You can’t say, I’m writing code but I’m not doing software engineering stuff. It doesn’t work like that. There are hidden performance traps in automation scripts. You write code and you don’t understand why, but the performance is really slow. In the next few series I want to share my experience as a software engineer and tell you about small technical choices that can have a direct impact on performance and user experience.

The first part we’ll talk about is data structures. And today I want to zoom in on set and list: when we should use sets and when we should use lists in automation scripts.

An example: you want to collect unique asset numbers from multiassetlocci.

A common approach is to use a list of asset numbers. Functionally fine until you run it on a record with 20000 assets and you’re surprised how slow it is.

assetnums = []
for row in multiassetset:
  asset = row.getString("ASSETNUM")
  if asset and asset not in assetnums:
    assetnums.append(asset)

What’s happening here?

asset not in assetnums does a scan each time, that means O(k) comparisons when the list already holds k items.

You do that check for every row (n rows) → O(n²) total work.

With 20,000 items that’s 200 million string comparisons! That’s why it feels mysteriously slow.

It would be better and faster if you used a set instead of a list. When you use a set, you don’t need to take care of duplicates, it’s already done for you. There won’t be duplicates in a set, and you have a constant lookup time. So, when you take an asset number from the set, you’re pretty quick.

assetnums = set()
for row in multiassetset:
  asset = row.getString("ASSETNUM")
  if asset:
    assetnums.add(asset)

Just remember:

  • Use set() when you only need unique values or fast membership checks.
  • Use list() when order or index access matters.

Ever noticed the difference yourself? Or do you have a script that felt just a bit too slow for no reason?

I would be happy to assist: info@annacode.nl

Anna van den Akker

Experienced IBM Maximo consultant with a solid software engineering background. I help businesses improve their systems effectively, handling tough tasks and delivering great outcomes.
Category

Share this post on: