Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Crystal looks really cool but if speed is what its after, i think it misses the target for most people.

because for most apps, you will be bottlenecked by the database server. it is the slowest hanging fruit on the tech stack, be it postgres , mysql, or mongo. so unless you are working on number crunching tasks that do not involve any db queries, i fail to see the benefit of a language like Crystal.

i wait for the day until the day Crystal becomes a 100% drop in replacement ready for Ruby apps.

until then, Sinatra is more than fast enough for most things.



I've heard this argument a lot, and have even used it myself as a justification for using Ruby on Rails over other technologies, because I like working with Ruby. However, I rewrote one of my large CRUD applications in Elixir and Phoenix a year or so ago (same database and same data) and was amazed at how fast my web app was when compared to the Rails version. I've had similar experiences with the Crystal code I've written (replacing vanilla Ruby), so I've had to step back from this argument and admit it isn't entirely valid.

I don't say this to knock Ruby. I love Ruby and think Matz is an outstanding human being. I'm just pointing out that while the database server can be a bottleneck, to be sure, there are still plenty of benefits to using faster languages to accomplish database-centric tasks.


> i fail to see the benefit of a language like Crystal.

For me it's a Ruby like language with static typing. For my typical use cases I don't really need the extra performance, but those two things are enough to make me interested.


This certainly used to be true, back when ram was expensive and drives were slow. But progress on both of those fronts has massively outpaced the increase in typical structured data, which is what you would store in a db. It's rich/unstructured data that has increased hugely in most usecases. But I would argue that it's not as cut and dry nowadays, particularly with the amount of serverside processing that is being done in other non-db areas.


It only takes a couple of gigabytes to build a dataset that can get painfully slow to go through in Ruby. Especially if you're not using the right techniques to store/parse it.


because for most apps, you will be bottlenecked by the database server.

Is there anything to suggest Crystal is primarily intended for use writing those kinds of applications? If we're talking about all of software development, most programs probably don't talk to that sort of database server at all.


This. Ruby is used where it's used because it's slow, and you can't write any professional, performant app with it. But if you have a similar language that it's safer and faster, Ruby syntax is a pleasure to work with.


How small is the lightest sinatra app though, when deployed in a container? We lately had some experience with dockerizing a moderately complex ruby app and it was pretty shocking how large they get compared to simple statically linked binaries.


This very much depends on the way you build a container.

If you take e.g. Alpine Linux as a base image, then build almost everything as a single step in a shell script, removing useless intermediate files, you get a pretty small image. If you take e.g. a normal Debian image and build it so that every step adds a layer, you end up with a large image.


im not sure what you are asking for in terms of lightness but its incredibly light in both concept and execution.

i mean it doesnt get any lighter than this.

require ‘sinatra’

get ‘/‘ do

  “hello”
end

you should check out https://github.com/jaequery/jasis

its a dockerized Sinatra app with all the bells and whistles and see how light it is yourself.


You do realize you are talking about totally different things compared to the post you answer to? You are talking amount of code, the post you are talking to are talking system resources. That is an apples to pears comparison.

Sinatra may be lighter than Rails resource wise, but it is still not in any way light compared to a compiled binary. The difference is pretty staggering in practice.


Sure but no useful app can be described by this "Hello HTTP" example. I've seen the same as parent: Ruby services require a lot more memory in their steady state than say, their Go service counterpart, for a same complexity.


you must be referring to Rails. sure they can be pretty big, as they are what you call a monolithic framework.

thats why i recommend Sinatra for performance conscious devs, as its a fast and minimal framework. and you get to load only what you need. check the github.com/jaequery/jasis github project and peek at the Gemfile / boot.rb to see all that it loads for a full fledged mvc app. its pretty explicit and lean if you ask me.

if are talking about server resource then you probably referring to the web server. for which we have ‘puma’ and it is also incredibly light and fast. much lighter than a php stack running Apache and mod_php for sure.

but i see you compared to Go to which we have no comparison Go will run circles around Ruby. but Go is not really a well suited environment for web applications yet so ill just leave it at that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: