4 ms·
That usually happens when you try to work with immutable data structures like you are used to with mutable datastructures. For example, if you append to a muta
by valenterry 3y ago
That usually happens when you try to work with immutable data structures like you are used to with mutable datastructures.
For example, if you append to a mutable list then it's going to be fast. But prepending to it is much slower. With immutable lists, it's the other way around. Not knowing that will make you think that immutable datastructures are generally slow, but they are not.
That being said, I would say they are generally more tricky, so it's good to understand in which cases it's worth to sacrifize safety and readability and switch to mutable datastructures for performance reasons.