output:
i took 20453 ticks
i took 10125 ticks
i took 8437 ticks
code:
function Test()
Integer i,j
Integer reps
Integer subtype
Boolean skip
Integer tick
List subtypelist = {0, 128, 142, 144, 557}
List keepAsList = {144, 557}
Assoc keepAsAssoc = Assoc.CreateAssoc()
keepAsAssoc.(0) = 0
keepAsAssoc.(144) = 144
tick = Date.Tick()
//test by iterating over the list
for i = 0 to 1000000
skip = true
for subtype in subtypelist
for j in keepAsList
if (j == subtype)
skip = false
break
end
end
end
end
echo("i took ", Date.Tick() - tick, " ticks")
tick = Date.Tick()
//test using IsFeature
for i = 0 to 1000000
for subtype in subtypelist
skip = IsFeature(keepAsAssoc, subtype)
end
end
echo("i took ", Date.Tick() - tick, " ticks")
tick = Date.Tick()
//test using is in list method
for i = 0 to 1000000
for subtype in subtypelist
skip = subtype in keepAsList
end
end
echo("i took ", Date.Tick() - tick, " ticks")
end
Comments