Remix.run Logo
nine_k 5 days ago

In Java, there are separate synchronized collections, because acquiring a lock takes time. Normally one uses thread-unsafe collections. Java also gives a very ergonomic way to run any fragment under a lock (the `synchronized` operator).

Rust avoids all this entirely, by using its type system.

layer8 4 days ago | parent | next [-]

Java has separate synchronized collections only because that was initially the default, until people realized that it doesn’t help for the common cases of check-and-modify operations or of having consistency invariants with state outside a single collections (besides the performance impact). In practice, synchronized collections are rarely useful, and instead accesses are synchronized externally.

noisem4ker 5 days ago | parent | prev [-]

Golang has a synchronized map:

https://pkg.go.dev/sync#Map