top | item 20897029

Parallelism in Crystal

139 points| sdogruyol | 6 years ago |crystal-lang.org | reply

41 comments

order
[+] jackcodes|6 years ago|reply
I’ve been using Crystal on-and-off for a couple of years and have started to use it as my primary language for most non-enterprise work. The current web-app I’m building is primarily written in Crystal and it has been an absolute joy to use, and even if I don’t strictly need parallelism in this project I’m glad they’re pushing though with the big language changes.

It’s been so successful at everything I’ve needed it for, I wouldn’t consider going back to either Ruby or similar interpreted languages, regardless whether it’s a little CLI helper or a larger monolith server app. I’ve found my ability to allow the compiler to catch bugs incredibly reliable without feeling bogged down with types. I hadn’t worked much with typed languages previously and as a Ruby developer it allowed me to ‘learn’ types without even feeling like I was doing any learning.

It’s still somewhat of an obscure language so I thought it would be helpful to describe my experiences with it.

[+] h1d|6 years ago|reply
Do you use much external libraries because ecosystem I'd pretty much what makes a language useful after the language being solid by itself.

Also, I assume Googleability is pretty much close to zero, you'd have to go to the primary sites (their forum?) to ask questions when stuck?

[+] freshbagels|6 years ago|reply
I'm curious as to what web-app you're building with it. Is it available to use?
[+] rishav_sharan|6 years ago|reply
I have been using crystal+ vanilla js for my pet project and the sheer joy i get from using this language is something else.

2019 has been a good year for crystal. Basic multithreading is in. Windows support is making good headway. I am optimistic that a working windows compiler would be out by end of year.

The last major dragon for crystal to slay would be the compilation time. It still feels unreasonably high. Hopefully that would be a major focus of 2020

[+] freshbagels|6 years ago|reply
I'm curious as to what your pet project is/if it's available to online to play with.
[+] Doctor_Fegg|6 years ago|reply
Delighted with this. I've been working on and off on a shortest-path routing engine in Crystal. Parallelism means I can get performance on a par with C++ even on large graphs, but with the simplicity and readability of Ruby. Full marks to the Crystal devs for tackling the no 1 feature request.
[+] faitswulff|6 years ago|reply
Aside, but is there a good class or resource for learning about parallelism in computing? I'm reading the blog post and vaguely recalling differences between threading and forking. I regularly encounter the same concepts over and over but they haven't been sticking. A hands-on project would be great.
[+] rarecoil|6 years ago|reply
I just learned about Crystal a couple of weeks ago and it's completely subsumed every new personal project I have into its domain. I have long missed Ruby's syntax and human-friendly feel, but began to prefer the speed I could find in other languages like Go.
[+] maitredusoi|6 years ago|reply
Until crystal get a REPL I would stick to ruby / rails for POC and MVP, then scaling problem "could" arose, so translate it to amber or lucky (Web Framework in crystal) could solve the issue. About Type and Casting Nil, gem like sorbet should be a good replacement in ruby
[+] squarefoot|6 years ago|reply
Waiting badly for an installable ARM port; small boards would benefit a lot from it. Is this planned in the future?
[+] aidenn0|6 years ago|reply
I get why N=2 is slower than single-threaded, but why is N=4 more than twice as fast as N=2?
[+] ricardobeat|6 years ago|reply
If you're looking at the first graph, the explanation is right above - the overhead of synchronization.
[+] DSingularity|6 years ago|reply
Why Crystal over C++?
[+] coldtea|6 years ago|reply
Because it's a much saner, coherent, and easier to use language with less footguns...

Now, why not Crystal over C++? Because it's way less mature, with way less documentation, way less resources, way worse tooling, way less libraries, way more implementation bugs, and, if we're realistic, it might never go anywhere...

[+] ravenstine|6 years ago|reply
Why C++ over assembly?
[+] penagwin|6 years ago|reply
For very similar reasons that they choose ruby over C++ ?
[+] odiroot|6 years ago|reply
To me is just Python-like (or actually Ruby-like but close enough) but with much better performance. I still haven't learnt to use it well though.

It's a joy to write due to its syntax.