@Norby many thanks for all your tips, I really appreciate it.
There is an other way to show and hide images: replace the equipment_required parts to drawCustomImage.
I made a test and I have converted all my code to use drawCustomImage instead of awarding/removing equipments, but the performance is pretty much identical as far as I can tell, perhaps even a bit worse than use equipments
I have also tested this OXP with vanilla 1.85, and then those lags are not present at all. It is when I have my huge list of OXPs installed that I start seeing issues. The thing is no other HUD shows these problems, but I guess that this work here is a bit heavier on the computer. Funny enough, my frame rate always stay around 50-60 fps, and the lags occur only on two moments: when the alert change between yellow and red (or vice-versa) and when the mass lock indicator changes its status. But if the alert condition or mass lock condition changes soon after a previous change, then no lag is present which is why I have been suspecting this is an issue with how images are cached.
I honestly ran out of ideas on how to try to optimize this...