Speeding Up the Market Table

by . .

Ahhh, it's a good night to do some coding. I improved the performance of the market page in my D&D application, reducing overall page load time from 2 seconds to 0.8 seconds.

Players purchase items using a "Buy" form. The DM has additional controls in that form to "Give" a player character tradegoods directly. One of those <form> elements exists for each player-purchasable tradegood, and there are about 1,200 of those now. While profiling, I discovered that the 100ish <option> tags on each "Buy/Give" form (one for each potential buyer or recipient of the purchase) were bloating the page to a horrific 25 MB.

I changed the application to only generate a specific "Buy/Give" form on-demand (when the user first opens it). Presto, we're down to a ~500 KB page.

The players had never complained about the usability of the page. They know that the tradegood system is massively complicated beast, so presumably a two-second load time didn't seem so bad. Still, I think they'll be happy.