6 ms·
As an internet user, I really enjoy reading about all these performance improvements in V8 / javascript. As a ruby developer, I'm insanely jealous.
by jerhinesmith 8y 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.
- sbjs 8y agoJust use Express.js or Sails.js, they're 1:1 to Sinatra or Rails. Join us!
- out_of_protocol 8y agoNot true unfortunately. Rails quality unreachable for current js frameworks. Well, i hope situation will change in the future
- skunkworker 8y agoWith 2.6 JIT Ruby should be much quicker this fall. It'll be interesting to come back around once they have method inlining.
- sbjs 8y agoDoes 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.
- savanaly 8y agoThere's definitely the need for this in JS. It would be extremely difficult to do, though.
- vinceguidry 8y agoPersonally, 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.
- tlrobinson 8y agoApparently 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 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.
- tlrobinson 8y agoAs 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.
- vinceguidry 8y agoI 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.
- gunn 8y agoDefinitely. 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.
- nicoburns 8y agoUnfortunately 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/ https://rocket.rs/
- sbjs 8y agoTypeScript 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-safe-rpc-with-typescript-20f131fff3e8 https://medium.com/@stevenbradleyconsulting/from-0-to-type-s...
- eropple 8y agoAw, man - I'd hoped you'd found something to make this less of a stone-cold pain to do. Instead, it's io-ts again. Which is...interesting...but it really sucks to actually use when you have to manually define every in/out yourself. It's 2018. There's no good reason TypeScript can't emit the type information to just build these (and I don't really mean decorator metadata).
- sbjs 8y agoYou can add another build step right after the `tsc -w` compilation phase, which takes your .ts files, parses them to find our your types, and emits runtime code that checks your types. That's what you're describing that TypeScript should be doing on its own. But I don't see why you'd want to do this instead of using io-ts? This is more complicated overall.
- crooked-v 8y agoIt sounds like you're looking for Ember. https://www.emberjs.com https://www.emberjs.com
- sbjs 8y agoEmber is a front-end framework, Rails is back-end.
- kowdermeister 8y agoWhat Rails features do you miss from which framework?
- nicoburns 8y agoUnfortunately 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.
- pmontra 8y agoI 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.
- mikermcneil 8y agoHave you tried Sails 1.0? (There’s always more to do, but we’re working to improve the framework a little more every day.)
- sbjs 8y agoAwesome 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!
- axlee 8y agoHow is Express even remotely close to Rails? Express is a glorified router.
- thomasfoster96 8y agoI think the parent comment was comparing Express to Sinatra and Sails.js to Rails respectively, not altogether.
- iammiles 8y agoI 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.
- EduardoBautista 8y agoExpress -> Sinatra Sails -> Rails
- nielsbot 8y agoYou might be interested in TruffleRuby: https://github.com/oracle/truffleruby https://github.com/oracle/truffleruby "A high performance implementation of the Ruby programming language. Built on the GraalVM by Oracle Labs."
- askaboutit 8y agoI 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.
- yxhuvud 8y agoUh, how is oracle a dying organization?
- willio58 8y agoI 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.
- repolfx 8y agoOracle 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.
- Twirrim 8y agoThere's also JRuby, Ruby running on the JVM. Which can be insanely fast for anything longer running than your typical CLI use case.
- lovelle 8y agoI 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
- abhorrence 8y ago2.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.
- munificent 8y agoV8 is also a method-based JIT as far as I know.
- jashmatthews 8y agoThe 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.
- windows_tips 8y agoIsn't there a Ruby->JS transpiler?
- ukz 8y agoOpal: https://github.com/opal/opal https://github.com/opal/opal
- tlrobinson 8y agoOut of curiosity, what are the major advantages Ruby has to offer over JavaScript?
- earenndil 8y agoWhat about jruby or oracle's java+ruby thing?
- Sohcahtoa82 8y agoReplace Ruby with Python and I have the same feelings.
- wongma 8y agoDon'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.
- chupasaurus 8y ago> security ... Rails One bad default setting and [0]BOOM! [0]https://github.com/rails/rails/commit/b83965785db1eec019edf1fc272b1aa393e6dc57 https://github.com/rails/rails/commit/b83965785db1eec019edf1...
- skrebbel 8y agoYou say "Ruby developer" as if you were born like that and stuck with it. There's an entire world out there!
- tinco 8y agoIf the alternative is JavaScript, I think most Ruby programmers are fine where they are ;)
- reitanqild 8y ago> 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 :-]
- konart 8y agoAnd here I am just happy I don't have to touch js.
- konart 8y agoI'm being downvoted because I can't be happy?
- eksemplar 8y agoYou’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?
- konart 8y agoHow my comment is different from this one - https://news.ycombinator.com/item?id=17650823 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.