Skip to content

Commit e08f369

Browse files
qurbonzodailya-g
authored andcommitted
Add changelog of changes in 0.2
1 parent 1891988 commit e08f369

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# CHANGELOG
2+
3+
## 0.2
4+
5+
#### Split immutable and persistent interfaces
6+
7+
- Immutable collections specify by their contract the real immutability of their implementors
8+
* `ImmutableCollection` extends read-only `Collection`
9+
* `ImmutableList` extends read-only `List` and `ImmutableCollection`, and overrides `subList` method that returns `ImmutableList`
10+
* `ImmutableSet` extends read-only `Set` and `ImmutableCollection`
11+
* `ImmutableMap` extends read-only `Map`, and overrides `keys`, `values` and `entries` properties types with `ImmutableSet`, `ImmutableCollection` and `ImmutableSet` respectively
12+
- Persistent collections extend immutable collections and provide modification operations that return new instances with the modification applied
13+
* `PersistentCollection` extends `ImmutableCollection`, and provides modification operations and builder
14+
* `PersistentList` extends `ImmutableList` and `PersistentCollection`, and provides modification operations
15+
* `PersistentSet` extends `ImmutableSet` and `PersistentCollection`, and provides modification operations
16+
* `PersistentMap` extends `ImmutableMap`, and provides modification operations and builder
17+
- `plus`, `minus` and `mutate` extension functions are available only persistent collections
18+
- Deprecate `immutableXOf()` top-level functions and introduce `persistentXOf()`
19+
- `toImmutableX()` extension functions return `ImmutableX`
20+
- Introduce `toPersistentX()` extension functions that return `PersistentX`
21+
22+
#### Replace PCollection-based prototypes with custom performant implementations
23+
24+
- `PersistentList` implementation is backed by a bit-mapped trie with branching factor of 32
25+
* `add(element: E)` and `removeAt(size - 1)` operations take O(1) time, down from O(log<sub>2</sub>n)
26+
* `get` and `set` operations take O(log<sub>32</sub>n), down from O(log<sub>2</sub>n) (though the same asymptotic)
27+
* Iteration has the same time complexity of O(n), but much faster in practice due to the better reference locality
28+
- Unordered `PersistentSet` implementation is backed by a hash-array mapped trie (a.k.a. HAMT) with up to 32 children or elements in a node
29+
* `contains`, `add` and `remove` operations take O(log<sub>32</sub>n) time, down from O(log<sub>2</sub>n)
30+
* Iteration has the same time complexity of O(n), but much faster in practice due to the better reference locality
31+
- Unordered `PersistentMap` implementation is backed by a compressed hash-array mapped prefix-tree (a.k.a. CHAMP) with up to 32 children or entries in a node
32+
* `contains`, `get`, `put` and `remove` operations take O(log<sub>32</sub>n) time, down from O(log<sub>2</sub>n)
33+
* Iteration has the same time complexity of O(n), but much faster in practice due to the better reference locality
34+
- Ordered `PersistentSet` implementation is backed by the unordered `PersistentMap` which maps elements in this set to next and previous elements in insertion order
35+
* `contains`, `get` and `put` operations take O(log<sub>32</sub>n) time, down from O(log<sub>2</sub>n)
36+
* `remove` operation takes O(log<sub>32</sub>n) time, down from O(n)
37+
* Iteration takes O(n log<sub>32</sub>n) time, up from O(n)
38+
- Ordered `PersistentMap` implementation is backed by the unordered `PersistentMap` which maps keys in this map to values, next and previous keys in insertion order
39+
* `contains`, `get` and `put` operations take O(log<sub>32</sub>n) time, down from O(log<sub>2</sub>n)
40+
* `remove` operation takes O(log<sub>32</sub>n) time, down from O(n)
41+
* Iteration takes O(n log<sub>32</sub>n) time, up from O(n)
42+
- Builders are backed by the same backing storage as the corresponding persistent collections, but apply modifications in-place if the node has already been copied
43+
* Time complexities of all operations are the same as of the corresponding persistent collections. However, avoiding memory allocations leads to significant performance improvement

0 commit comments

Comments
 (0)