Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Correct if i'm wrong: The general conclusion is Vectors are faster and pattern matching is slower in observable way when generating vectors.

I wonder if it changes when vec items becomes bigger structs and size goes to millions.

Rust dosc says with LinkedLists that you should better use Vec for speed. I think just raw array of bytes is always faster than linked pointers. But LinkedList will probably have less of a memory pressure in cases where you have to maintain large list and remove elements at random while keeping coherency.

from Rust docs: Vector = "A contiguous growable array type, written Vec<T> but pronounced 'vector'."

LinkedList = "A doubly-linked list with owned nodes.

The LinkedList allows pushing and popping elements at either end in constant time.

NOTE: It is almost always better to use Vec or VecDeque because array-based containers are generally faster, more memory efficient, and make better use of CPU cache."



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: