r/programming • • Jul 20 '20

Implementing cosine in C from scratch

http://web.eecs.utk.edu/~azh/blog/cosine.html
503 Upvotes

104 comments sorted by

View all comments

Show parent comments

8

u/bitwize Jul 20 '20

Everything you learned in undergrad CS is wrong, because cache.

Other examples: Never, EVER use linked lists. Arrays and vectors are almost always faster to the point where banning linked lists is a sound strategy. And it is often literally faster to search, say, an array of packed key-value pairs than to use a hash table with pointers.

1

u/Cobayo Jul 21 '20

Linked lists have their uses, particularly to implement persistent data structures