Hacker News new | ask | show | jobs
by jerhinesmith 2882 days ago
As an internet user, I really enjoy reading about all these performance improvements in V8 / javascript.

As a ruby developer, I'm insanely jealous.

9 comments

You might be interested in TruffleRuby: https://github.com/oracle/truffleruby "A high performance implementation of the Ruby programming language. Built on the GraalVM by Oracle Labs."
I researched this yesterday against Crystal. Seems people won’t touch it because of oracle. Which is a real shame. Truffle is a 9x improvement in speed over Ruby. But because Oracle is a patent nightmare and a dying organization. People aren’t interested.
Uh, how is oracle a dying organization?
I went to go look for evidence of oracle dying and actually came up empty handed. I was also under this impression. I think it has waned significantly in popularity in the developer community over the years, but their stock isn’t bad at all and they seem to have diversified quite a bit in the time they’ve existed.
Oracle doesn't even seem that patent happy these days. They seem to have got burned by their experience with the Java patents (all useless, case revolves now around copyright).

Financially Oracle is doing very well indeed.

There's also JRuby, Ruby running on the JVM. Which can be insanely fast for anything longer running than your typical CLI use case.
I believe Truffle was 3-4x+ faster than Jruby. This is what Ruby needs. But Oracle will ruin it.
headius is at a jvm conf right now talking about optimizing JRuby, and here's a recent video on the subject: https://www.youtube.com/watch?v=4vxIncIm2D4
Well, JRuby runs on the JVM which is developed by Oracle. Basically, if you're a ruby user who wants good performance there's not many other places to turn.

But you know Oracle acquired Java long ago and other than Google, I'm unaware of Oracle causing problems for any other users. And Google is a rather special case - they reimplemented an incompatible version of Java without licensing it. You're not going to be doing that.

It's open source, the community can always fork it and move forwards if they dislike what Oracle does with it.
Don't be too jealous. My main concern with Node and its ecosystem is maturity and security. It loses hands down on both those points compared Ruby / Rails especially in the area of dependencies.

This keeps me happily in Rubyland.

> security ... Rails

One bad default setting and [0]BOOM! [0]https://github.com/rails/rails/commit/b83965785db1eec019edf1...

You say "Ruby developer" as if you were born like that and stuck with it. There's an entire world out there!
If the alternative is JavaScript, I think most Ruby programmers are fine where they are ;)
I don't know. I'd say that both Ruby and JavaScript are pretty awesome these days.
It certainly is a lot better than it was. Though every time I'm allowed back at the backend, Ruby is just such a breath of fresh air.
Just use Express.js or Sails.js, they're 1:1 to Sinatra or Rails. Join us!
Unfortunately Sails is nowhere near as good as Rails. Which is kind of strange given the size of the JavaScript community, and the fact that PHP has Laravel and Python has Django, both of which are comparable to Rails.

Amusingly given all the PHP hate, if you want a faster rails-like framework, Laravel might be your best bet.

I don't know anything about Laravel but I've been working with Rails since 2006 and with Django since 2016. Django has little to do with Rails. It's much more similar to Java Struts from 2005 (when I left it for Rails), form objects and template tags among the other nuisances. No XML thanks god, but a weak deployment story (no Capistrano or Mina, I built my own tool). I'd pick Django over Struts without thinking (I don't do Java anymore, even with morr modern frameworks), but I pick Rails over Django any time customers give me the choice. Django (and Struts) are optimized for large projects at the cost of developer time but very few projects grow even to medium sized. Django has a decent admin tool. That's the only advantage I can think it has over Rails for the typical project I do. I also worked with Phoenix (Elixir) in the last 12 months. It's kind of midway between Rails and Django in terms of framework and language complexity.
Have you tried Sails 1.0? (There’s always more to do, but we’re working to improve the framework a little more every day.)
Awesome to see the creator of Sails here! And awesome that you have such a positive and constructive response to criticisms! I see that Sails is also a company and not just an open source project, are you a full time company living off of using your open source work? If so can you give any advice to someone who is trying to learn how to make a living with open source? I am full of energy and passion for software and want to put that towards open source, but it would be much nicer to also get paid while doing so!
Not true unfortunately. Rails quality unreachable for current js frameworks. Well, i hope situation will change in the future
Does that mean there's still room in the JS ecosystem for a Rails-alike? Maybe one that could become very popular? Because I am looking for a major open source project to create and spearhead, something that could get hundreds of thousands of active users and a thriving subcommunity, but I've been holding off until I find just the right project.
Personally, having developed in both Rails and Node, I now believe that trying to recreate Rails in JS is a foolish effort. Rails is a huge project with a ton of weight behind it and unless you can generate a massive amount of corporate investment, you won't ever be able to really catch up.

I'm not saying that there's no room in the JS ecosystem for another web framework, what I'm saying is that if your design goal is re-implementing Rails, you're already setting yourself up for failure. Sequelize has tried to be ActiveRecord for how long? The only thing it makes me do is want to go back to Ruby and Rails.

No, what you have to figure out if you want to do a JavaScript web framework is how to get me to actually want to use JavaScript to program a website. How can prototypical inheritance actually contribute to a workflow as opposed to a more conventional inheritance scheme.

But honestly, quite frankly, I can't tell what anyone would want to use JavaScript on the server at all for.

Apparently Steve Yegge ported much of Rails to JavaScript (on Rhino, at the time) back in 2007 at Google, but it was never open sourced AFAIK: https://steve-yegge.blogspot.com/2007/06/rhino-on-rails.html

For comparison, (according to `find . -name "*.rb" | xargs wc -l`) Rails back then was about 66K LOC (plus 38K LOC of tests) and is now 137K LOC (plus 216K LOC of tests).

However, Steve says he only ported "essentially all of ActionView, ActionController and Railties, plus a teeny bit of ActiveRecord", so maybe half of the total.

As for the second half of your comment, it sounds like you haven't used JavaScript in awhile. ES6 introduced syntax for classical inheritance, and a bunch of other nice features.
I use ES6 at my job, daily. There are some things about it that make me really hate it. First, no, it doesn't introduce classical inheritance. It introduced syntax that looks like classical inheritance. It's still prototypal inheritance under the hood. I'm not entirely sure what this means yet from the standpoint of building things with it, but I'm not enthused at the prospect.

What I find happens fairly frequently with ES6 that I never found with Vanilla JS is that the extra features built on top of JS 'break'. If you add syntax to a language, that syntax needs to work. I need to be able to rely on it working. I run into constant little issues that make me think I'm missing something about scoping, when really it's some under-the-hood issue with a library or something I just don't have the time to pin down.

One example is I tried using the spread operator to add keys to an object. But the spread simply, well, failed. Passing in the object worked fine. Passing in a spread version of the same object failed. I haven't resolved it yet, got pulled onto another feature. This sort of breakage is hard to Google, when I run into it again, and I'm sure I will, I may have to troubleshoot it all the way to Babel.

Error reporting in Node with ES6 is garbage. Worse than garbage, it's a veritable dumpster fire. Ideally the error points to the problem, when it doesn't point to the problem you have to rely on experience and intuition to lead you to the issue. Many many errors I come across in JS are of this sort.

I think most of these issues come down to the fact that ES6 is a transpiled language. This makes me long for the days of good old CoffeeScript. At least CS was close enough to Vanilla that it was easy to determine when you had an issue with the transpiler, simply grab the snippet of code and paste it into the online transpiler, look at the generated JS and work out your issue from there. It wasn't the smoothest workflow but it was effective.

ES6 is stupid in ways that make building an effective workflow unreasonably difficult. I can't wait to get back to Rails. Vanilla JS wasn't that bad. It was well-understood and you could work with it effectively on the front-end. It certainly wasn't as pleasant as Ruby, but it didn't feel like the pile of hacks that ES6 does. Maybe once it stops being transpiled it'll get better.

It sounds like you're looking for Ember. https://www.emberjs.com
Ember is a front-end framework, Rails is back-end.
Definitely. And using these technologies, there are some cool possibilities beyond what rails is capable of.

For instance if you used typescript (still allows devs to use plain JS), you could use types to check that forms send all the required params. For example, a login page might require:

    interface LoginParams {
      username: string;
      password: string;
      rememberMe?: boolean;
    }
Having the typescript compiler check for inconsistencies with form data would save a lot of the troubles I've seen in rails apps.
Unfortunately TypeScript doesn't do runtime checks like this. It assumes that incoming data conforms to the type spec! However, you might be interested in the Rocket framework (written in Rust), which does do exactly that:

https://rocket.rs/

TypeScript can do runtime checks like this! Granted it uses a TypeScript framework (similar to AJV) that both does the runtime checks and preserves type information for your IDE and type checker. I wrote about it here:

https://medium.com/@stevenbradleyconsulting/from-0-to-type-s...

There's definitely the need for this in JS. It would be extremely difficult to do, though.
With 2.6 JIT Ruby should be much quicker this fall. It'll be interesting to come back around once they have method inlining.
What Rails features do you miss from which framework?
How is Express even remotely close to Rails? Express is a glorified router.
I think the parent comment was comparing Express to Sinatra and Sails.js to Rails respectively, not altogether.
I believe parent's intention was to say that Express is like Sinatra and Sails is like Rails.

To which I agree with the Express / Sinatra similarity.

Express -> Sinatra

Sails -> Rails

> As an internet user, I really enjoy reading about all these performance improvements in V8 / javascript.

As an Internet user whos has been reading for years about how fast the various js engines are it annoys me that the web still feels slow :-]

What about jruby or oracle's java+ruby thing?
Replace Ruby with Python and I have the same feelings.
And here I am just happy I don't have to touch js.
I'm being downvoted because I can't be happy?
You’re probably being downvoted because your comment doesn’t contribute anything to the thread. And rightly so, unless you want HN to be as useless as /r/programming.

Your comment is also borderline rude, as it implies that anyone using JavaScript are unfortunate. I mean, what did you really want to achieve by posting that comment?

How my comment is different from this one - https://news.ycombinator.com/item?id=17650823 for example?

>Your comment is also borderline rude, as it implies that anyone using JavaScript are unfortunate

No, it does not, that's just your interpretation. I never used word 'fortunate' or anything similar. I'm happy not to work with it as in "I'm happy not to use public transport today, because I like walking". Surely this can't be rude to anyone except those people who see everything as way to offence them somehow. Inferiority complex maybe? No idea.

> I mean, what did you really want to achieve by posting that comment?

Just wanted to express myself. As it turns out that's a wrong thing to do unless you have some sort of clear goal in mind. Noted.

I would insanely choose ruby rather than javascript for the major advantages that has to offer. Performance in most of cases is not a real needed over consistency. Also Ruby 2.6 has jit, would be great to see some bench tests. :P
2.6’s JIT is entirely at the method level currently, and unfortunately for certain types of workloads (e.g. Rails) this means the performance benefit is largely outweighed by the call counters and deoptimization checks on every method invocation.

There’s definitely room for improvement, and the inclusion of JIT infrastructure is awesome, it’s just not making much of a performance impact. Yet.

The overheads from the call counters and deoptimization checks are tiny. The real problem is that right now MJIT doesn't allow much optimization beyond generating native code equivalent to simply executing the instructions. It's ridiculously simple compared to V8.
V8 is also a method-based JIT as far as I know.
Out of curiosity, what are the major advantages Ruby has to offer over JavaScript?
Isn't there a Ruby->JS transpiler?