Quantcast WoWInterface - View Single Post - Addon settings take excessive amount of time/syscalls
View Single Post
11-27-16, 05:33 PM   #2
A Pyroguard Emberseer
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,905
There's more going that ProcessMonitor cannot show that's making all those write operations. What you're looking at is a serializer that takes a Lua object and converts it back into Lua-readable code that can be loaded back in as-is. I can only guess that it's writing per line as the serializer iterates through the settings table and writes out the resulting data. Without seeing what is written for each and every write call, it's hard to be sure. What I am positive about is that the 9 seconds it takes to write the file isn't solely from the write calls, but the serializer iterating through the settings table and using string manipulation to format the output between the calls.

Data loss for changes in the current session can happen before this process even begins as WoW doesn't save addon settings in the middle of a session unless a UI reload is performed. Crashing during the write isn't likely as everything is stopped when this takes place.

There are definitely better methods of saving data, but I think Blizzard opted for this approach for the ease of performing a Lua dofile() call on load.
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 11-27-16 at 05:56 PM.