3 ms·
You don't need transactions for this, just use immutable data structures and you get _transactional like_ behaviour for free.
by louthy 10y ago
You don't need transactions for this, just use immutable data structures and you get _transactional like_ behaviour for free.
- taneq 10y agoIt's not free. The cost is reallocation every time something changes, which in many cases is all the time. Not all the world's a web page.
- louthy 10y ago> Not all the world's a web page Did you really need that patronising statement? My point wasn't about memory usage, it was about development cost. The transactional behaviour emerges by default from use of immutable structures. Any transactional system will have memory performance characteristics that are very similar to using immutable structures, if not worse, so your point was, well, pointless.
- jinjin2 10y agoI guess that you could think of Realm as an immutable data structure (as it is immutable outside of very specific conditions like inside write transactions and a state refreshes at "safe" points in the code. But the experience is totally different. It basically feels like you have plain old (mutable) objects, but they can be safely shared between threads without any of the overhead (mentally and performace wise) of locks.
- jinjin2 10y agoI guess that you could think of Realm as an immutable data structure (as it is immutable outside of very specific conditions like inside write transactions and a state refreshes at "safe" points in the code. But the experience is totally different. It basically feels like you have plain old (mutable) objects, but they can be safely shared between threads without any of the overhead (mentally and performace wise) of locks.