top | item 28976445

(no title)

MillenialMan | 4 years ago

Threading doesn't compensate for that degree of slowdown, and itself has overhead. You'll get something back, but not much.

discuss

order

dgb23|4 years ago

Again, generalisations about performance like that is just not very useful. There are use cases where you get significant benefits from using persistent data structures.

Aeron comes to mind as an example in regards to high performance solutions that uses them. But a more fundamental reason is that immutability can be part of your domain logic. Think video games like braid, or business applications where you need to derive a lot of different views and go back and forth between them, or domains where data just is inherently immutable such as accounting and so on.

MillenialMan|4 years ago

I don't really agree. Cache friendliness is almost always a relevant factor as soon as performance becomes an issue. I get what you're saying but as I see it immutability gives you architectural efficiency and in some cases space efficiency, but rarely processing speed.

> Think video games like braid

Braid doesn't use immutable data structures, it uses a historical record (and immutability would be incompatible with some of the mechanics).[1] The author of Braid is actually quite famous for his dislike of functional languages and immutability. He doesn't even like garbage collection because of the overhead it introduces.

Interestingly, he was talking about data structures for codebase representation (in the context of a compiler) a while back, and someone mentioned HAMTs. I'm definitely curious if they would work well there.

[1] https://www.youtube.com/watch?v=8dinUbg2h70

reitzensteinm|4 years ago

In my experience you can usually achieve near linear speed up. My machine can run 24 threads.

MillenialMan|4 years ago

Fair enough on scaling. But 24 is still a lot less than two to three orders of magnitude.

gnuvince|4 years ago

Could you share an example program that does that?