Array-like containers aren’t the only containers we need. Today we’ll look at the non-array containers the C++ Standard Library provides, including its equivalents of Dictionary
, HashSet
, and LinkedList
.
Posts Tagged linkedlist
We use certain container types, like maps and dynamic arrays, constantly. Others, like linked lists and queues, more sparingly. Still, they are fundamental structures in virtually every program and the poster children for generic programming. Like C#, the Standard Library in C++ provides a bunch of container types. Today we’ll start going through them, starting with containers for various kinds of arrays!
Last time in the series we encountered and overcame a host of esoteric issues on our path to a better understanding of Unity’s native collection system. This week we’ll continue on that journey and grapple with even more challenges in this new, unexplored area of Unity.
Continuing from last time, today we’ll greatly expand on the fledgling NativeLinkedList<T>
that we started last time. By the end of the article, we’ll have a useful native collection available to us!
Unity 2018.1 shipped with just one true native container: NativeArray<T>
. Now Unity 2018.2 has been released and there is still just the one native container. We’ve seen how to implement more, but never wrote much more than a proof of concept. Today we’ll begin implementing NativeLinkedList<T>
as an example of a native container for a very well known, simple data type. The result is available on GitHub for any project to use.
Contrary to what you may have learned in a data structures class, linked lists are virtually always slower than just using arrays. The same goes for array wrapper classes like List
. Today’s article discusses why this is the case and tests it out with a C# Unity app to make sure that the real world validates the theory.
Linked lists can be much faster than AS3’s Array
and Vector
classes if you use them under the right circumstances. It’s been over a year and a half since I last visited the topic, but today it’s time to update my LinkedList
class. Read on for the freshly-optimized code and all-new performance testing and analysis!
Continuing in the series on linked lists that started with parts one and two, today I’ll make the first serious optimization pass on the LinkedList implementation. Read on for how successful this is.
Last time I began covering linked lists in AS3. As anyone who has ever taken a data structures class can tell you, this is definitely a core data structure. As such, it has numerous benefits compared to other single-dimensional data structures like arrays and hash tables. The Array class in AS3 is far from a C/C++ array, which is simply a contiguous block of memory. AS3’s Array class blurs the lines between arrays, linked lists, and hash tables. So as I implement a linked list class in AS3 it is quite interesting to see how the normal pros and cons change. I’ve expanded on the LinkedList class I started last week and done some more preliminary performance testing. Read on to see the updates.
I’ve written before about linked lists when I covered free lists. There were massive speedups to be had there, but that article mostly covered the performance costs of allocation and deallocation. Today is part one of a series that more generally covers linked lists.