2 ms·
What do you mean by great concurrency? Last I checked multithreading was still hidden behind an experimental compiler flag, which turns me off a bit...
by sph 4y ago
What do you mean by great concurrency? Last I checked multithreading was still hidden behind an experimental compiler flag, which turns me off a bit...
- kitd 4y agoNot OP, but the concurrency model is similar to Go with its use of channels. At the moment the runtime is single-core, but the chosen model should permit multi-core (when they enable it by default) with little to no changes to user source. Tbh, I prefer it that way round than try to retrofit multi-core onto a model that wasn't designed for it. But yes, single-core feels a bit behind the curve in 2022.
- straight-shoota 4y agoconcurrency != multi-threading. Crystal's concurrency is based on fibers (green threads) which works very well even on a single thread (it scales to multiple threads, as well) And for many use cases with high parallelization and little shared state (including web applications such as a search engine), multi-threading isn't necessary. Synchronization overhead is a serious performance killer. You can get much more performance out of running N processes with a single thread instead of a single process running N threads.
- zw963 4y agoHope a lot of people can see this, detailed explanation come from Crystal core developers. because a lot of beginners complain that Crystal's fiber doesn't work on multiple cores/multiple threads and then give up using it, it's probably not as important as people think. Even many beginners mistakenly believe that the Crystal language does not support the creation of operating system native Thread, this is a huge misunderstanding for Crystal.
- samuell 4y agoI did a small comparison of implementing pipeline concurrency in Go and Crystal: https://rillabs.com/posts/crystal-concurrency-easier-syntax-than-golang https://rillabs.com/posts/crystal-concurrency-easier-syntax-... Crystal pretty much provides the same (great) concurrency functionality with light-weight threads and channels etc, but with a cleaner syntax and in my experience less gotchas around closing channels in the wrong place and order etc. The main downsides compared to Go I've seen is: - (As mentioned) Compile times - Far less compelling cross-compilation story