WoWInterface - View Single Post - setText or setFormattedText or ?
View Single Post
11-01-16, 11:16 PM   #11
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 26
Originally Posted by Phanx View Post
The difference is that SetFormattedText shifts the string.format operation over into C code, where it's (presumably) faster than running it in Lua. Unless you're doing it a million times in a row, though, you'll never notice the difference, so the main reason to use SetFormattedText is that it makes your code less verbose and more readable.
I believe the real difference is that resulting formatted string doesn't enter Lua's hashed pool, thus not only providing noticeable speed up, but also saving you from tons of throwaway strings for GC to clean up later. This could be trivially tested by :SetText(format("%s", GeTtime)) in OnUpdate and watching garbage counter grow vs. SetFormattedText. I'll try it later to confirm (unless I'll forget about that).
Garrison Mission Manager
  Reply With Quote