<https://kt.academy/article/var_readonly_vs_val_mu...
# feed
m
m
Modifications to var with read-only collection require making a copy of the entire collection. For large collections, that is a heavy and memory-consuming operation.
Persistent data structures alleviate this issue by sharing parts of the data with the previous collection before the operation. I think they aren’t as popular in Kotlin as in languages like Scala or Clojure, where more emphasis is placed on immutability. But for most use cases, persistent data structures offer a great balance between performance and correctness/maintainability. So much that, in my opinion, they should be considered as the default option in most projects.