performance improvements
This commit is contained in:
+13
-7
@@ -677,33 +677,39 @@ local methods = {
|
|||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
|
|
||||||
UpdateRowInfo = function(self)
|
UpdateRowInfo = function(self)
|
||||||
|
for _, info in self.rowInfo do
|
||||||
|
if type(info) == 'table' then
|
||||||
|
for _, child in info.children do release(child) end
|
||||||
|
release(info.children)
|
||||||
|
release(info)
|
||||||
|
end
|
||||||
|
end
|
||||||
wipe(self.rowInfo)
|
wipe(self.rowInfo)
|
||||||
self.rowInfo.numDisplayRows = 0
|
self.rowInfo.numDisplayRows = 0
|
||||||
self.isSorted = nil
|
self.isSorted = nil
|
||||||
self:SetSelectedRecord(nil, true)
|
self:SetSelectedRecord(nil, true)
|
||||||
|
|
||||||
sort(self.records, function(a, b) return a.search_signature < b.search_signature or a.search_signature == b.search_signature and tostring(a) < tostring(b) end)
|
local records = self.records
|
||||||
|
if getn(records) == 0 then return end
|
||||||
local records = self.records
|
sort(records, function(a, b) return a.search_signature < b.search_signature or a.search_signature == b.search_signature and tostring(a) < tostring(b) end)
|
||||||
if getn(records) == 0 then return end
|
|
||||||
|
|
||||||
-- Populate the row info from the database by combining identical auctions and auctions
|
-- Populate the row info from the database by combining identical auctions and auctions
|
||||||
-- of the same base item. Also, get the number of rows which will be shown.
|
-- of the same base item. Also, get the number of rows which will be shown.
|
||||||
for i = 1, getn(records) do
|
for i = 1, getn(records) do
|
||||||
local record = records[i]
|
local record = records[i]
|
||||||
local prevRecord = records[i-1]
|
local prevRecord = records[i - 1]
|
||||||
if prevRecord and record.search_signature == prevRecord.search_signature then
|
if prevRecord and record.search_signature == prevRecord.search_signature then
|
||||||
-- it's an identical auction to the previous row so increment the number of auctions
|
-- it's an identical auction to the previous row so increment the number of auctions
|
||||||
self.rowInfo[getn(self.rowInfo)].children[getn(self.rowInfo[getn(self.rowInfo)].children)].numAuctions = self.rowInfo[getn(self.rowInfo)].children[getn(self.rowInfo[getn(self.rowInfo)].children)].numAuctions + 1
|
self.rowInfo[getn(self.rowInfo)].children[getn(self.rowInfo[getn(self.rowInfo)].children)].numAuctions = self.rowInfo[getn(self.rowInfo)].children[getn(self.rowInfo[getn(self.rowInfo)].children)].numAuctions + 1
|
||||||
elseif prevRecord and record.item_key == prevRecord.item_key then
|
elseif prevRecord and record.item_key == prevRecord.item_key then
|
||||||
-- it's the same base item as the previous row so insert a new auction
|
-- it's the same base item as the previous row so insert a new auction
|
||||||
tinsert(self.rowInfo[getn(self.rowInfo)].children, {numAuctions=1, record=record})
|
tinsert(self.rowInfo[getn(self.rowInfo)].children, T('numAuctions', 1, 'record', record))
|
||||||
if self.expanded[self.rowInfo[getn(self.rowInfo)].expandKey] then
|
if self.expanded[self.rowInfo[getn(self.rowInfo)].expandKey] then
|
||||||
self.rowInfo.numDisplayRows = self.rowInfo.numDisplayRows + 1
|
self.rowInfo.numDisplayRows = self.rowInfo.numDisplayRows + 1
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- it's a different base item from the previous row
|
-- it's a different base item from the previous row
|
||||||
tinsert(self.rowInfo, {item_key=record.item_key, expandKey=record.item_key, children={{numAuctions=1, record=record}}})
|
tinsert(self.rowInfo, T('item_key', record.item_key, 'expandKey', record.item_key, 'children', A(T('numAuctions', 1, 'record', record))))
|
||||||
self.rowInfo.numDisplayRows = self.rowInfo.numDisplayRows + 1
|
self.rowInfo.numDisplayRows = self.rowInfo.numDisplayRows + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+6
-6
@@ -144,18 +144,18 @@ function update_auction_listing()
|
|||||||
buyout_color = inline_color.yellow
|
buyout_color = inline_color.yellow
|
||||||
end
|
end
|
||||||
|
|
||||||
tinsert(auction_rows, {
|
tinsert(auction_rows, T(
|
||||||
cols = {
|
'cols', A(
|
||||||
{value=auction_record.own and color.yellow(auction_record.count) or auction_record.count},
|
{value=auction_record.own and color.yellow(auction_record.count) or auction_record.count},
|
||||||
{value=al.time_left(auction_record.duration)},
|
{value=al.time_left(auction_record.duration)},
|
||||||
{value=auction_record.stack_size == stack_size and color.yellow(auction_record.stack_size) or auction_record.stack_size},
|
{value=auction_record.stack_size == stack_size and color.yellow(auction_record.stack_size) or auction_record.stack_size},
|
||||||
{value=money.to_string(auction_record.unit_blizzard_bid, true, nil, 3, bid_color)},
|
{value=money.to_string(auction_record.unit_blizzard_bid, true, nil, 3, bid_color)},
|
||||||
{value=historical_value and al.percentage_historical(round(auction_record.unit_blizzard_bid / historical_value * 100)) or '---'},
|
{value=historical_value and al.percentage_historical(round(auction_record.unit_blizzard_bid / historical_value * 100)) or '---'},
|
||||||
{value=auction_record.unit_buyout_price > 0 and money.to_string(auction_record.unit_buyout_price, true, nil, 3, buyout_color) or '---'},
|
{value=auction_record.unit_buyout_price > 0 and money.to_string(auction_record.unit_buyout_price, true, nil, 3, buyout_color) or '---'},
|
||||||
{value=auction_record.unit_buyout_price > 0 and historical_value and al.percentage_historical(round(auction_record.unit_buyout_price / historical_value * 100)) or '---'},
|
{value=auction_record.unit_buyout_price > 0 and historical_value and al.percentage_historical(round(auction_record.unit_buyout_price / historical_value * 100)) or '---'}
|
||||||
},
|
),
|
||||||
record = auction_record,
|
'record', auction_record
|
||||||
})
|
))
|
||||||
end
|
end
|
||||||
sort(auction_rows, function(a, b)
|
sort(auction_rows, function(a, b)
|
||||||
return sort_util.multi_lt(
|
return sort_util.multi_lt(
|
||||||
|
|||||||
+19
-19
@@ -10,42 +10,42 @@ function update_search_listings()
|
|||||||
local autobuy_filter_rows = t
|
local autobuy_filter_rows = t
|
||||||
for i, autobuy_filter in aux_auto_buy_filters do
|
for i, autobuy_filter in aux_auto_buy_filters do
|
||||||
local name = strsub(autobuy_filter.prettified, 1, 250)
|
local name = strsub(autobuy_filter.prettified, 1, 250)
|
||||||
tinsert(autobuy_filter_rows, {
|
tinsert(autobuy_filter_rows, T(
|
||||||
cols = {{value=name}},
|
'cols', A(T('value', name)),
|
||||||
search = autobuy_filter,
|
'search', autobuy_filter,
|
||||||
index = i,
|
'index', i
|
||||||
})
|
))
|
||||||
end
|
end
|
||||||
auto_buy_listing:SetData(autobuy_filter_rows)
|
auto_buy_listing:SetData(autobuy_filter_rows)
|
||||||
|
|
||||||
local favorite_search_rows = t
|
local favorite_search_rows = t
|
||||||
for i, favorite_search in aux_favorite_searches do
|
for i, favorite_search in aux_favorite_searches do
|
||||||
local name = strsub(favorite_search.prettified, 1, 250)
|
local name = strsub(favorite_search.prettified, 1, 250)
|
||||||
tinsert(favorite_search_rows, {
|
tinsert(favorite_search_rows, T(
|
||||||
cols = {{value=name}},
|
'cols', A(T('value', name)),
|
||||||
search = favorite_search,
|
'search', favorite_search,
|
||||||
index = i,
|
'index', i
|
||||||
})
|
))
|
||||||
end
|
end
|
||||||
favorite_searches_listing:SetData(favorite_search_rows)
|
favorite_searches_listing:SetData(favorite_search_rows)
|
||||||
|
|
||||||
local recent_search_rows = t
|
local recent_search_rows = t
|
||||||
for i, recent_search in aux_recent_searches do
|
for i, recent_search in aux_recent_searches do
|
||||||
local name = strsub(recent_search.prettified, 1, 250)
|
local name = strsub(recent_search.prettified, 1, 250)
|
||||||
tinsert(recent_search_rows, {
|
tinsert(recent_search_rows, T(
|
||||||
cols = {{value=name}},
|
'cols', A(T('value', name)),
|
||||||
search = recent_search,
|
'search', recent_search,
|
||||||
index = i,
|
'index', i
|
||||||
})
|
))
|
||||||
end
|
end
|
||||||
recent_searches_listing:SetData(recent_search_rows)
|
recent_searches_listing:SetData(recent_search_rows)
|
||||||
end
|
end
|
||||||
|
|
||||||
function new_recent_search(filter_string, prettified)
|
function new_recent_search(filter_string, prettified)
|
||||||
tinsert(aux_recent_searches, 1, {
|
tinsert(aux_recent_searches, 1, T(
|
||||||
filter_string = filter_string,
|
'filter_string', filter_string,
|
||||||
prettified = prettified,
|
'prettified', prettified
|
||||||
})
|
))
|
||||||
while getn(aux_recent_searches) > 50 do
|
while getn(aux_recent_searches) > 50 do
|
||||||
tremove(aux_recent_searches)
|
tremove(aux_recent_searches)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user