News for hackers. Stuff that matters.
Re:Crystal Programming Language by freediver on Friday September 02, 2022 @01:52AM (#32687071)
Huge props for the Crystal lang team.

Crystal powers 90% of the Kagi search backend (reminder being Python). Highlights are great performance and concurency handling. Biggest downsides at this moment are compilation speed (does not take advantage of multi CPU cores) and debugging tools.

Overall our experience has been fantastic (we adopted it while still in beta) and the pace the language is developing is great.

Re:Crystal Programming Language by widdershins on Friday September 02, 2022 @02:36AM (#32687312)
Ah, that's interesting information. I've been a (paid) user of Kagi these last few weeks and I'm really enjoying its snappiness.

Of course, no ads or trackers must help - when I look at the Network tab in developer tools the comparison with a google search is stark. ~4 requests vs. google's ~50.

Re:Crystal Programming Language by freediver on Friday September 02, 2022 @03:32AM (#32687728)
We obssess over performance, thanks for noticing that :)
Re:Crystal Programming Language by Nextgrid on Friday September 02, 2022 @06:31AM (#32689017)
I find Kagi consistently faster to respond than DDG.
Re:Crystal Programming Language by californical on Friday September 02, 2022 @02:48AM (#32687406)
Wow! I’ve been paying for Kagi for as long as it’s been possible to, love the project & the search results are truly so much better than I’ve gotten from Big G for most queries.

Never would’ve expected it to be using Crystal though! That’s really neat. Are there open source bits? I’d love to see some enterprise-level Crystal examples

Re:Crystal Programming Language by freediver on Friday September 02, 2022 @03:33AM (#32687742)
We have plans for open sourcing our compontets, including a blog post from our lead dev about how we use Crystal, but never seem to find the time - always some bigger fish to fry.
Re:Crystal Programming Language by jm4 on Friday September 02, 2022 @08:28AM (#32689796)
Just want to say I am very happy with Kagi. I've been a paying subscriber since there was an announcement here a few months ago. The results are typically very good, the speed is unreal, and features like lenses and personalized results are so awesome. It's so nice not having search results filled with Stack Overflow spam sites, and if anything slips through I can block it.
Re:Crystal Programming Language by simonebrunozzi on Friday September 02, 2022 @10:07AM (#32691049)
Funny, I submitted this on HN because I've read that Kagi is powered by Crystal, and then went and took a look at it.

p.s. hi Vlad :)

Re:Crystal Programming Language by sph on Friday September 02, 2022 @04:25AM (#32688145)
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...
Re:Crystal Programming Language by samuell on Friday September 02, 2022 @07:24AM (#32689329)
I did a small comparison of implementing pipeline concurrency in Go and Crystal:

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

Re:Crystal Programming Language by kitd on Friday September 02, 2022 @06:31AM (#32689021)
Not 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.

Re:Crystal Programming Language by straight-shoota on Friday September 02, 2022 @06:36AM (#32689038)
concurrency != 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.

Re:Crystal Programming Language by zw963 on Friday September 02, 2022 @11:57AM (#32692319)
Hope 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.