zaira Posted June 28, 2016 Posted June 28, 2016 Which is faster: a. Array.Find b. FormList.Find Which is better: a. Check the type of a Form and then cast it if akForm.GetType() == 46 Potion p = akForm as Potion ... endif b. Or simply cast Potion p = akForm as Potion if p ... endif
Guest Posted June 28, 2016 Posted June 28, 2016 Direct cast is faster than first checking and then casting. Because the type check is always done internally, also if the class is the right one. About finding, form list searches by ID of the form. While Array searches by comparing values. I don't know if internally the formlist.find will still check every item one by one or does some better indexing (I don't think it does) But at least you are not comparing strings in formlist but numbers (the IDs), so it should be a little bit faster.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.