Modified:
trunk/OptionHouse/OH_PerfMon.lua
Log:
OptionHouse:
* You know whats cool? When your perfmon addon wastes memory
* L["FOO"] .. string.format() has to be the stupidest thing I've seen
today =(
* Fixed OptionHouse to use SetFormattedText, and to not create two
garbage strings on every single update. Jeesh
Modified: trunk/OptionHouse/OH_PerfMon.lua
==============================================================================
--- trunk/OptionHouse/OH_PerfMon.lua (original)
+++ trunk/OptionHouse/OH_PerfMon.lua Wed Nov 28 11:55:58 2007
@@ -115,22 +115,22 @@
end
if( frame.totalMemory > 1000 ) then
- frame.sortButtons[2]:SetText(L["MEMORY"] .. string.format("
(%.1f %s)", frame.totalMemory / 1000, "MiB"))
+ frame.sortButtons[2]:SetFormattedText("%s (%.1f %s)", L["MEMORY"],
frame.totalMemory / 1000, "MiB")
else
- frame.sortButtons[2]:SetText(L["MEMORY"] .. string.format("
(%.1f %s)", frame.totalMemory, "KiB"))
+ frame.sortButtons[2]:SetFormattedText("%s (%.1f %s)", L["MEMORY"], frame.totalMemory, "KiB")
end
if( frame.totalMIR > 100 ) then
- frame.sortButtons[3]:SetText(L["MEMSEC"] .. string.format("
(%.2f %s)", frame.totalMIR / 1000, "MiB/s"))
+ frame.sortButtons[3]:SetFormattedText("%s (%.2f %s)", L["MEMSEC"],
frame.totalMIR / 1000, "MiB/s")
else
- frame.sortButtons[3]:SetText(L["MEMSEC"] .. string.format("
(%.2f %s)", frame.totalMIR, "KiB/s"))
+ frame.sortButtons[3]:SetFormattedText("%s (%.2f %s)", L["MEMSEC"], frame.totalMIR, "KiB/s")
end
if( scriptProfiling ) then
- frame.sortButtons[4]:SetText(L["CPU"] .. string.format(" (%.2f)", frame.totalCPU))
+ frame.sortButtons[4]:SetFormattedText("%s (%.2f)", L["CPU"], frame.totalCPU))
frame.sortButtons[4]:SetWidth(frame.sortButtons[4]:GetFontString():GetStringWidth()
+ 3)
- frame.sortButtons[5]:SetText(L["CPUSEC"] .. string.format(" (%.2f)", frame.totalCIR))
+ frame.sortButtons[5]:SetFormattedText("%s (%.2f)", L["CPUSEC"], frame.totalCIR))
frame.sortButtons[5]:SetWidth(frame.sortButtons[5]:GetFontString():GetStringWidth()
+ 3)
end
@@ -148,20 +148,20 @@
row[1]:SetText(addon.title)
if( addon.memory > 1000 ) then
- row[2]:SetText(string.format("%.3f MiB (%.2f%%)", addon.memory /
1000, addon.memPerct))
+ row[2]:SetFormattedText("%.3f MiB (%.2f%%)", addon.memory / 1000, addon.memPerct)
else
- row[2]:SetText(string.format("%.3f KiB (%.2f%%)", addon.memory, addon.memPerct))
+ row[2]:SetFormattedText("%.3f KiB (%.2f%%)", addon.memory, addon.memPerct)
end
if( addon.mir > 1000 ) then
- row[3]:SetText(string.format("%.3f MiB/s", addon.mir / 1000))
+ row[3]:SetFormattedText("%.3f MiB/s", addon.mir / 1000)
else
- row[3]:SetText(string.format("%.3f KiB/s", addon.mir))
+ row[3]:SetFormattedText("%.3f KiB/s", addon.mir)
end
if( scriptProfiling ) then
- row[4]:SetText(string.format("%.3f (%.2f%%)", addon.cpu, addon.cpuPerct))
- row[5]:SetText(string.format("%.3f", addon.cir))
+ row[4]:SetFormattedText("%.3f (%.2f%%)", addon.cpu, addon.cpuPerct)
+ row[5]:SetFormattedText("%.3f", addon.cir)
else
row[4]:SetText("----")
row[5]:SetText("----")