vb6 - Which is better for performance -
recently had write function compares combobox list of items record set database. after finishing work i'm wondering better performance.
solution 1
foreach item in combobox1 foreach record in recordset if item.id = record["id"] foundincombo = true exit end if next record if foundincombo = false combobox1.removeitem(item) end if next item
solution 2
foreach item in combobox1 foreach record in recordset if item.id = record["id"] foundincombo = true recordset.remove(record) exit end if next record if foundincombo = false combobox1.removeitem(item) end if next item
this pseudo code of course, , know in modern languages there better ways this, in vb6 , i'm curious if overhead in removing of record record set offsets less amounts of iterations of entire loop.
update: in case learning older language , working in legacy code limited ability change made test based on comments below, , found not of difference first 25 items, once got around 100 started have performance gains removing item.
Comments
Post a Comment