| ▲ | Concurrency, interactivity, mutability, choose two(n16f.net) | ||||||||||||||||||||||
| 32 points by billiob 3 days ago | 15 comments | |||||||||||||||||||||||
| ▲ | roenxi 2 hours ago | parent | next [-] | ||||||||||||||||||||||
> But again, there is no free lunch: copying data is slow. Very slow. Of course you can optimize data representations, avoid copying binary blobs (they are ref-counted in Erlang) because it would be untenable. But it will still be horribly slow. You don't have to copy the data; it is immutable. Why copy something that isn't going to change? Are we being charged for empty RAM? Different objects can share the same structure. Famously, this is what Clojure does. Theoretically it can be faster than mutating objects because you only have to write the parts that are changing (which is the same as a mutable object), you lose something to overheads (might be nearly negligible) and have enormous gains in situations where you might need a copy of an object for some reason because that is free; there isn't any reason to actually do a copy unless the data itself is going to be mutated. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | socketcluster 3 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
You can substitute the word 'interactivity' with 'statefulness' and it makes the statement more intuitive IMO. Concurrency + statefulness means you can't have mutability because then you would run the risk of a concurrent update overwriting another. But you can have concurrent read-only state, so long as concurrent writing is not permitted. This is the 'single writer principle' which is a variant of the 'single source of truth principle'. You can't have concurrent writing in this case. If you have statefulness + mutability then you must do away with concurrency; a different way to avoid the same concurrent overwriting problem mentioned above. If you have concurrency + mutability, then that's possible if you don't have state... You could have multiple independent, divergent copies of the state but not a single consistent state. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | my-next-account 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
You can have it all in the vast majority of cases. It just requires a lot of work. See: The Hotspot JVM. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | mrkeen 3 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
This doesn't follow at all!
No-one to randomly access runtime data? Do "other threads" not count? There are no concurrency issues in C?
Why would you copy anything? Copying is defense against mutation. It's what you do for safety when you're working in a language with pervasive mutation, and it's opt-in and manual, meaning it works about as well as other opt-in and manual operations, like malloc and free.Peeking over the fence at an immutable language and thinking "that runtime does too much copying, which is bad!" is like peeking over the fence at a GC language and thinking "that runtime does too many mallocs and frees, which is bad!" | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | atemerev 19 minutes ago | parent | prev | next [-] | ||||||||||||||||||||||
Choose three. Preemptive actor model (Erlang, Elixir, Gleam) for backend. https://pouchdb.com for frontend. | |||||||||||||||||||||||
| ▲ | eqvinox 2 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
RCU needs discussing in an article like this. It arguably fudges the definitions of all 3 things a little, but you do get them all. | |||||||||||||||||||||||
| ▲ | okkdev 2 hours ago | parent | prev [-] | ||||||||||||||||||||||
That linked benchmark feels weird. The discrepancy is way too big. I'll need to take a look into the slower contestants. | |||||||||||||||||||||||