setText or setFormattedText or ?
View Single Post
11-01-16, 11:16 PM
A Fallenroot Satyr
Join Date: Jun 2007
Originally Posted by
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
View Public Profile
Send a private message to rowaasr13
Find More Posts by rowaasr13