Is it possible to compile ruby




















Collectives on Stack Overflow. Learn more. How to compile Ruby? Ask Question. Asked 10 years, 6 months ago.

Active 11 months ago. Viewed 60k times. Is there a tool that can allow me to compile Ruby code so that it runs somewhat faster? Improve this question. Flethuseo Flethuseo 5, 10 10 gold badges 43 43 silver badges 68 68 bronze badges. The only use of the term "pyc" I am aware of is as the file extension for bytecode. There's Cython which is a different language that can be used to write fairly low-level code that gladly talks to Python it accepts vanilla Python, but at best gives you one or two percent performance if you don't add type annotations.

There's also PyPy which can achive tremedous speedups but you propably wouldn't consider it a compiler, as it's a JIT compiler. Also see stackoverflow. Add a comment. Active Oldest Votes. Improve this answer. The first step is to compile the source code to bytecode with the mrbc program:. The -b switch tells the program that the file is bytecode rather than plain Ruby code:.

This variant is interesting for those who want to integrate Ruby code directly into their C code. It will create a C array containing the bytecode which you then have to execute by yourself. The first step is to compile the Ruby program.

Recently he tweeted out he generated a million dollars from his business[1]. If you can get ms or less p95 response times without a complicated infrastructure then the only thing that matters is the ecosystem, community and how much you enjoy using that technology. If performance is a web framework's biggest feature then I think they're fighting an uphill battle. Performance isn't that important for most applications as long as you can produce a nice feeling application that responds quickly.

All modern frameworks have a means to do that. Now it comes down to how fast can you build it and how nice is it to maintain. I guess it depends on what you build. At the scale of GitHub and Twitter or Shopify there are probably significant challenges caused by said bloat. But once you reach that level of scale you have or should have! Not choosing Rails because you intend some day to get to Twitter scale smells of premature optimisation. Twitter themselves used Ruby!

Yep, which is generally why I can't see a good argument for not using it. I was hoping to see some here but it seems to be a consensus view.

If there is one that claims to, it is probably lying. I have had to help scale a large scale Rails app and break it apart about 5 years ago. That was tough. A lot of the features that Shopify and Github have upstreamed since then would have helped a lot and to be honest it is a lot easier to scale now with Rails because of those upstreamed features.

Like multiple databases, viewcomponents, etc. The weird thing is we have to keep semi-apologising for choosing Rails. Why is that? For each his own. I love Rails, sue me. I am all for your love of Rails, but tools should not be picked based on how much you love them. Choose the correct tool for the job, if it is rails, good for you.

For me its Rails, also because I love it. All these stacks are good enough and have been used countless times in varying scales. For example if you are building something around nlp, probably pick python. Also, since you are all into ruby, maybe take a look around as to why other languages exist. There's a solid question as to why the tool you'd pick for CRUD databasey stuff should be coupled to what you'd pick for NLP heavy lifting by the interpreter.

Different jobs, different tools. That's quite a specific use case and as a mainly backend web developer I don't hit many nlp problems. That's usually a whole specialisation of it's own. I've been around. Still like Rails, works well for me. Thanks for the advice :. Depends why you love Ruby. If you love it because you adore programming languages with red logos then yes, bad choice. But if you love it because it lets you work quickly and performs well then that is a reason to pick it.

I can list some good qualities I love about Ruby, but I don't know if that's gonna be a great answer. It just clicked with me and analysing it too much is futile.

Kinda like analysing why you love your friends is futile: sure, you can list some good qualities. But you could also list good qualities of people who aren't your best friends. It just so happens sometimes a person or a tool clicks with you, it's being in the right place at the right time with this tool. I can see why C or Python make sense for people. But they haven't clicked with me so they're not my friends.

We have no history together. Now I'm not saying you can't ever grow out of your friends or languages , I just haven't outgrew Ruby. I'm sure if joel loves rails, it must be working for him. If it didn't, surely he'd hate it, no? You can continue to build everything with the language you love. But there are cases where a certain thing is just easier to get done in a particular language.

And there is nothing about hating any language. This is what brought me to RoR land I agree rapid prototyping is an excellent point for RoR but when you need to actually evolve the project for years, it gets really tedious and hard. So for a dev shop RoR is quite fine -- you make the project, do very little iteration on it, and ship. That works well and I've experienced it. For longer-lived projects however, Phoenix is miles ahead.

Even Rust's Rocket, but only if you are willing to invent a lot of stuff yourself auth for example. JeremyNT on Sept 21, root parent next [—]. I can't speak to Phoenix, but I've looked into Rocket and don't understand how it can really be compared to Rails. And don't get me wrong, I'd love to sit down and do that work, but my job is to make stuff work and make it work quickly, and my employer doesn't hire enough people that we can afford to dedicate that kind of time when it's already "solved" by a framework.

I tend to work on projects where the requirements change constantly, and they're never really "done. What makes you say it is hard to maintain longer lived projects? I used to be a RoR developer for a few years, so I'm curious about other people's experiences.

As a person maintaining multiple Rails codebases approaching a decade in age: RoR just bitrots incredibly fast and its really difficult to catch or update. With each new version of RoR gems just stop being compatible without replacement, and its a fairly significant effort to migrate everything to the new shiny being introduced.

Every other tech explicitly configures and calls features being used, but Rails is mostly held together by "convention", but convention evolves. How do you search for things like "the filename of this must match the class name of this" or "the method name must match this database feature". Nevermind the metaprogrammed methods that aren't documented anywhere.

The convention evolving as developer preferences changes is generally a good thing and keeps RoR from becoming too dated but it is an expensive maintenance burden.

But I'm definitely souring to it for long running professional work. When you are tracing a bug and are trying to do step-by-step debugging, it has been hell. Quickly jumping to definitions? Even RubyMine can't do it. Sure it's a management problem but it doesn't help that people don't do the right thing by default.

Mark Mark k 17 17 gold badges silver badges bronze badges. Not with the MRI interpretter, no. Mister X Mister X 11 3 3 bronze badges. Depends on your ruby.

Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Explaining the semiconductor shortage, and how it might end. Does ES6 make JavaScript frameworks obsolete? Featured on Meta. Now live: A fully responsive profile. Linked Related Hot Network Questions.



0コメント

  • 1000 / 1000