Jump to content

fps drop


Recommended Posts

  • 2 weeks later...
Posted

(This is weeks old, and I apologize for that -- I have been busy though.

 

Arrays and linked lists are O(n) for searching and retrieving.

 

Yes... sometimes.

 

 

Sorted arrays are O(log n) for searching and O(n) for "appending".

 

Unsorted arrays are be O(n) for searching and can be O(1) for appending (but the naive implementation is O(n)).

 

A nice feature of arrays is that they have a low cache impact. (Cache thrashing can eat a lot of cpu time.) If your data structures are small, the O(n) overhead of an array can be faster than the O(log n) of a tree.

 

(If your data structures are large there are other tricks you can use. For example, you can have a large sorted array and a small array of recent additions (you need to search both)).

 

Archived

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

  • Recently Browsing   0 members

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