How to make TradeSkillMaster auction posting 100x faster in World of Warcraft (TSM 4.11.66)

I sometimes like to tinker around with the economy in World of Warcraft for fun, and one of my favorite auction posting tools is a popular tool called TradeSkillMaster.

Is your TradeSkillMaster running slow? Does it take forever to post auctions? Does your game freeze every time you press the “Post” button?

I run a couple thousand auctions on my server and TSM had crawled down to a point where it was almost unusably slow when posting multiple auctions. Every time I would press the post button, the whole game would almost completely freeze for over half a second.

Slow Auction Posting (Before the Fix):

I couldn’t find any answers anywhere online, so I rolled up my sleeves, fired up VS Code, installed some LUA language plugins, looked up the Comprehensive Beginner’s Guide for WoW Addon Coding in Lua, and started digging directly into the LUA code for the TradeSkillMaster addon.

I spent a couple of hours digging through the various LUA modules in the TradeSkillMaster addon sub-folders until I stumbled upon a likely suspect. When I used the /etrace command in WoW, I noticed that everything was freezing right after the AUCTION_OWNED_LIST_UPDATE event fired. From what I could tell, this event was being handled by code in the “World of Warcraft\_classic_\Interface\AddOns\TradeSkillMaster\LibTSM\Service\AuctionTracking.lua” addon file. After methodically profiling and timing the various methods within that file, I figured out exactly what was causing the massive slowdown.

The problem was caused by the fact that every single time I would post a new item, TSM was programmed to completely rebuild the entire auction item index and store it inside of IndexDB via a bulk insert. That bulk insert was taking over half a second to run, during which WoW would almost completely freeze. The frame rate would drop from 120 fps down to 20 fps, and the game would be unresponsive to input during that period.

This auction posting index update occurs automatically in the background while the auction house window is open, whenever the AUCTION_OWNED_LIST_UPDATE event occurs, and it also occurs whenever the number of owned auctions changes. This triggers the AuctionOwnedListUpdateDelayed() method every single time an auction is posted.

When I timed this indexing operation, I discovered that it was taking 0.862 seconds to complete the LUA operation. However, if I completely commented out the code that updated the auction house index, the code would complete in only 0.008 seconds. A 100x performance increase!

From what I can tell, it doesn’t really matter that much if the item posting index is updated immediately after every auction posting, because it will automatically get updated by the background auto-updater anyways. So I implemented a simple check in the AuctionOwnedListUpdateDelayed() method so that it skips the update if the user is in the middle of rapidly chain posting a bunch of items.

I accomplished this by adding a new variable named “lastPostTime” into the private variables. This variable is set to the current time via “GetTime()” whenever the Post button is pressed. Then, inside of the AuctionOwnedListUpdateDelayed() method, we modify it to simply return immediately if an auction has been posted within the last second.

This gives me the ability to rapidly post hundreds of auctions, but if I stop clicking the button for even one second, the index automatically rebuilds itself like normal.

Here is the code changes that are required:

Around line 24 of AuctionTracking.lua, modify the private object so that it has “lastPostTime = 0” at the beginning, like so:

Then, find the private.PostAuctionHookHandler() method somewhere around line 552 and add the line “private.lastPostTime = GetTime();” to the very first line inside of the method, like so:

Now, find the private.AuctionOwnedListUpdateDelayed() method, somewhere around line 370, and add these lines as the very first lines within the method, like so:

Boom! All of your accounting should continue working perfectly, and you should be able to post thousands of auctions without everything freezing between every posting.

I tried posting this fix on the /r/WoWEconomy subreddit, and I also tried posting it in the official Discord server for TSM, but they blocked my post because they don’t allow people to share modified TSM code. I didn’t want my work to be lost, though, so I am sharing it here in a blog post. Hopefully this fix (or maybe an even better one) will eventually make its way into the official TradeSkillMaster addon.

Fast Auction Posting (After the Fix):

Side note: WoW has an item posting throttle limit in place on their API, so even though TSM itself is running fast now, this is about the maximum speed limit that you can post auctions to the WoW server. You can see that it is much faster than the previous video, however, and you can also see how the frame rate barely even dips now.

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you a real person? *