Need advice about which tool to choose?Ask the StackShare community!

mruby

6
10
+ 1
0
Ruby

41.1K
21.2K
+ 1
4K
Add tool

Ruby vs mruby: What are the differences?

Introduction

In this article, we will discuss the key differences between Ruby and mruby. Ruby is a popular dynamic programming language, while mruby is a lightweight implementation of Ruby.

  1. Memory Usage: One of the key differences between Ruby and mruby is the memory usage. mruby is designed to be lightweight and optimized for embedded systems, resulting in lower memory consumption compared to standard Ruby. This makes mruby a suitable choice for resource-constrained environments.

  2. Performance: Another significant difference is the performance of Ruby and mruby. mruby is known for its faster execution speed compared to Ruby. This improved performance is achieved through various optimizations implemented in mruby, making it a preferred choice for performance-critical applications.

  3. Extension Support: Ruby provides extensive support for third-party extensions and libraries through its vibrant ecosystem. On the other hand, mruby has limited support for extensions due to its lightweight nature. While some extensions can be ported to mruby, not all Ruby gems or libraries are compatible with mruby.

  4. Compatibility: Ruby is a mature programming language with a vast user base and community support. It has been around for many years and has a wide range of libraries and frameworks available. mruby, being a lightweight implementation, may not have complete compatibility with all Ruby features and syntax. Some advanced or niche Ruby features may not be supported in mruby.

  5. Embeddability: mruby is designed to be easily embeddable in other applications or systems. It provides a simple and lightweight interface for integrating Ruby functionality into existing projects. Ruby, on the other hand, is typically used as a standalone programming language for developing web applications or scripts.

  6. Footprint: Ruby has a relatively larger footprint compared to mruby. Due to its lightweight design, mruby has a smaller binary size, making it suitable for scenarios where space is a constraint. This smaller footprint also contributes to faster startup times for mruby applications.

In summary, mruby differentiates itself from Ruby by offering lower memory usage, improved performance, limited extension support, compatibility considerations, easy embeddability, and a smaller footprint.

Decisions about mruby and Ruby
Andrew Carpenter
Chief Software Architect at Xelex Digital, LLC · | 16 upvotes · 403.2K views

In 2015 as Xelex Digital was paving a new technology path, moving from ASP.NET web services and web applications, we knew that we wanted to move to a more modular decoupled base of applications centered around REST APIs.

To that end we spent several months studying API design patterns and decided to use our own adaptation of CRUD, specifically a SCRUD pattern that elevates query params to a more central role via the Search action.

Once we nailed down the API design pattern it was time to decide what language(s) our new APIs would be built upon. Our team has always been driven by the right tool for the job rather than what we know best. That said, in balancing practicality we chose to focus on 3 options that our team had deep experience with and knew the pros and cons of.

For us it came down to C#, JavaScript, and Ruby. At the time we owned our infrastructure, racks in cages, that were all loaded with Windows. We were also at a point that we were using that infrastructure to it's fullest and could not afford additional servers running Linux. That's a long way of saying we decided against Ruby as it doesn't play nice on Windows.

That left us with two options. We went a very unconventional route for deciding between the two. We built MVP APIs on both. The interfaces were identical and interchangeable. What we found was easily quantifiable differences.

We were able to iterate on our Node based APIs much more rapidly than we were our C# APIs. For us this was owed to the community coupled with the extremely dynamic nature of JS. There were tradeoffs we considered, latency was (acceptably) higher on requests to our Node APIs. No strong types to protect us from ourselves, but we've rarely found that to be an issue.

As such we decided to commit resources to our Node APIs and push it out as the core brain of our new system. We haven't looked back since. It has consistently met our needs, scaling with us, getting better with time as continually pour into and expand our capabilities.

See more
Thomas Miller
Talent Co-Ordinator at Tessian · | 16 upvotes · 229.7K views

In December we successfully flipped around half a billion monthly API requests from our Ruby on Rails application to some new Python 3 applications. Our Head of Engineering has written a great article as to why we decided to transition from Ruby on Rails to Python 3! Read more about it in the link below.

See more
Mike Fiedler
Enterprise Architect at Warby Parker · | 3 upvotes · 221.2K views

When I was evaluating languages to write this app in, I considered either Python or JavaScript at the time. I find Ruby very pleasant to read and write, and the Ruby community has built out a wide variety of test tools and approaches, helping e deliver better software faster. Along with Rails, and the Ruby-first Heroku support, this was an easy decision.

See more
Get Advice from developers at your company using StackShare Enterprise. Sign up for StackShare Enterprise.
Learn More
Pros of mruby
Pros of Ruby
    Be the first to leave a pro
    • 605
      Programme friendly
    • 536
      Quick to develop
    • 490
      Great community
    • 468
      Productivity
    • 432
      Simplicity
    • 273
      Open source
    • 234
      Meta-programming
    • 207
      Powerful
    • 156
      Blocks
    • 139
      Powerful one-liners
    • 69
      Flexible
    • 58
      Easy to learn
    • 51
      Easy to start
    • 42
      Maintainability
    • 37
      Lambdas
    • 30
      Procs
    • 21
      Fun to write
    • 19
      Diverse web frameworks
    • 13
      Reads like English
    • 10
      Makes me smarter and happier
    • 9
      Rails
    • 8
      Very Dynamic
    • 8
      Elegant syntax
    • 6
      Matz
    • 5
      Object Oriented
    • 5
      Programmer happiness
    • 4
      Elegant code
    • 4
      Generally fun but makes you wanna cry sometimes
    • 4
      Friendly
    • 4
      Fun and useful
    • 3
      Easy packaging and modules
    • 3
      There are so many ways to make it do what you want
    • 2
      Primitive types can be tampered with

    Sign up to add or upvote prosMake informed product decisions

    Cons of mruby
    Cons of Ruby
      Be the first to leave a con
      • 7
        Memory hog
      • 7
        Really slow if you're not really careful
      • 3
        Nested Blocks can make code unreadable
      • 2
        Encouraging imperative programming
      • 1
        Ambiguous Syntax, such as function parentheses

      Sign up to add or upvote consMake informed product decisions

      What is mruby?

      It is the lightweight implementation of the Ruby language complying with part of the ISO standard. It can be linked and embedded within your application.

      What is Ruby?

      Ruby is a language of careful balance. Its creator, Yukihiro “Matz” Matsumoto, blended parts of his favorite languages (Perl, Smalltalk, Eiffel, Ada, and Lisp) to form a new language that balanced functional programming with imperative programming.

      Need advice about which tool to choose?Ask the StackShare community!

      What companies use mruby?
      What companies use Ruby?
        No companies found
        See which teams inside your own company are using mruby or Ruby.
        Sign up for StackShare EnterpriseLearn More

        Sign up to get full access to all the companiesMake informed product decisions

        What tools integrate with mruby?
        What tools integrate with Ruby?

        Sign up to get full access to all the tool integrationsMake informed product decisions

        Blog Posts

        Nov 20 2019 at 3:38AM

        OneSignal

        PostgreSQLRedisRuby+8
        9
        4639
        Oct 24 2019 at 7:43PM

        AppSignal

        JavaScriptNode.jsJava+8
        5
        954
        Jun 6 2019 at 5:11PM

        AppSignal

        RedisRubyKafka+9
        15
        1639
        GitHubDockerReact+17
        40
        36262
        What are some alternatives to mruby and Ruby?
        Lua
        Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.
        Python
        Python is a general purpose programming language created by Guido Van Rossum. Python is most praised for its elegant syntax and readable code, if you are just beginning your programming career python suits you best.
        JavaScript
        JavaScript is most known as the scripting language for Web pages, but used in many non-browser environments as well such as node.js or Apache CouchDB. It is a prototype-based, multi-paradigm scripting language that is dynamic,and supports object-oriented, imperative, and functional programming styles.
        HTML5
        HTML5 is a core technology markup language of the Internet used for structuring and presenting content for the World Wide Web. As of October 2014 this is the final and complete fifth revision of the HTML standard of the World Wide Web Consortium (W3C). The previous version, HTML 4, was standardised in 1997.
        PHP
        Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.
        See all alternatives