for(var/datum/foo/bar as() in list)
is faster than the usual typecheckless
for(var/i in list)
var/datum/foo/bar = i
And it'd be nice to have some documentation in the reference (http://www.byond.com/docs/ref/#/proc/for/list) pertaining to what exactly it does
From what I can see, the only difference between your two versions is that the second one is doing an extra assignment and the first is calling istype() internally. When I was going through the logic of both, it occurred to me that you have two incref and decref calls either way, so I'm not at all sure why the istype() version would be faster.