ArrayDeques and How to Contribute to Scala 2.13
summary
mutable.ArrayDeque is a circular-buffer implementation that replaces many mutable Scala collections and claims faster common operations than Lists, Buffers, Stacks and Queues. It provides constant-time random access plus O(1) prepend/append/delete by keeping start/end indices and using modular arithmetic (with a power-of-two bitmask optimization). Resizing moves blocks via array.copy/memcpy (2–3 memcopies), supports clear vs clear-and-shrink to avoid GC leaks, and shows benchmarks where most ops win while random-indexing pays a small bitwise cost. Contributions welcome.
AI-written summary · about
chapters (7)
- 0:00Start
- 3:23Array Decks
- 4:00Data Structures 101
- 7:38Implementation of an Array Attack
- 8:04How Do I Insert an Element at the Ayat'index
- 12:13Demo
- 20:47Benchmarks
related talks
28mArrayDeques and How to Contribute to Scala 2.13 Collections
39mExtreme Cleverness: Functional Data Structures in Scala
51mImplementing the Scala 2.13 collections
42mWhat Scala can learn from Rust, Swift, and C++
35mMigrating to Scala 2.13
46mImmutable Sequential Maps – Keeping order while hashed
37mWhat’s in the next iteration of the standard collections?
54mHow Not to Write Slow Scala
