ikzann
Member
Hi all,
After getting a little frustrated with how quickly Mafia chews up my laptop battery, I decided to run it through a profiler to see what seems to be generating the most CPU usage. Below are some quick highlights from a first run while running a farming script, and I'd be happy to dive deeper into any of these. I'm sure the devs who spend more time on Mafia know some of these already, but posting anyway in case it's helpful. I will spend some time with the code this weekend and see if I can't fix any of the issues.
After getting a little frustrated with how quickly Mafia chews up my laptop battery, I decided to run it through a profiler to see what seems to be generating the most CPU usage. Below are some quick highlights from a first run while running a farming script, and I'd be happy to dive deeper into any of these. I'm sure the devs who spend more time on Mafia know some of these already, but posting anyway in case it's helpful. I will spend some time with the code this weekend and see if I can't fix any of the issues.
- As everyone seems to have keyed in on a little lately - I think you added the preference, Veracity? - the biggest standout is the concoction database refreshes. 40% of time during my profiling session was spent on sorting the LockableListModel during a concoction database refresh. It feels like the concoction database should be updated lazily, only when there is creation going on, but I haven't spent enough time with the code.
- 13% of time was spent updating equipment each adventure. Not sure exactly why this is so expensive.
- 12% of time was spent running HtmlCleaner on resulting HTML. I am not sure if there is a way around this, but flagging anyway.
- 10% of time was spent doing preference updates. Preference updates are generally slow because every update leads to a full serialization of the entire preference DB. Preferences that update every combat are especially impactful. Maybe there is some way to defer this update so it's once per combat round instead of multiple times at end of combat, which I believe is how it works now.