gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Lists?

#51516 - Dannon - Sat Aug 20, 2005 11:34 pm

What sort of lists will run well on the DS? I was thinking of using a vector list to store some data in my program, but don't know how fast it'll be, would a linked list be a better idea?

#51522 - DekuTree64 - Sun Aug 21, 2005 2:38 am

Depends entirely on the problem, none of them are 'better' for the DS.

Linked lists are good if you need to insert/remove elements frequently, but you have to traverse the list to access any particular one.

Vectors are good if you need random access, and don't know how big your list will get. Bad if you need to remove/insert things in the middle of the list.

Static arrays are best if you know ahead of time the maximum number of elements you can have.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#51529 - Dannon - Sun Aug 21, 2005 9:25 am

Thanks, I know about their advantages, I just wasn't sure on how well any of them work with the DS so was just wondering what peoples experiences were.

I'm not trying to access the list quickly, but it does need to be dynamic so I'm going to try a vector list and see how it goes, I may implement a linked list too and try to test the speed some how

#51546 - tepples - Sun Aug 21, 2005 5:15 pm

Vectors are like C arrays.

Each element of a linked list is a separate object, with a pointer to the data and a pointer to the next element of the list.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.