Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Thank you for follow up. My understanding is that default stack size if 1MB or 8MB on most platforms (on embedded maybe way smaller) so this maybe determining factor, otherwise, let's keep it on stack!
A vector always uses more space than an array, and will always be slower if you know the length you need ahead of time. A vector has to store the values on the heap, and store its pointer, length, and capacity on the stack. An array just keeps its length and values on the stack. The only reason I can think of to use a vector over an array is if the length of the list needs to change at runtime. If the length doesn't change at runtime, but is determined once at runtime and then fixed, it's usually a good idea to use a
Box<[T]>
, since those are still heap allocated but don't keep track of their capacity because they can't change length. ABox<[T]>
can also help in the rare occasion that you want to use an array that's too big for the stack space the OS gives you.Thank you! Great advice! I wonder up to which size on which architectures, array makes more sense then vector ...
There's no need to use a vector here when you know the list will only ever be length 256. An array works fine and performs better.