Jump to content

Some papyrus performance questions


zaira

Recommended Posts

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
Link to comment

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.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use