I noticed that the filesize of Ruby's interpreter seems suspiciously small.

I would have expected /bin/dash to be the smallest of all, but is 20x larger than Ruby:

Interpreter       Bytes
------------  ---------
Node 0.10.32  8,790,152
Python 3.4.0  4,061,272
Bash 4.3.11   1,021,112
gawk 4.0.01     441,512
Dash            121,272
Ruby 1.9.3        6,304

I know that, unlike Node/Python, that Ruby binary doesn't launch REPL. Perhaps the interpreter built in a modular way that spreads itself over several files rather than collecting them in one large binary?

(irb binary also suspiciously small:)

irb 1.9.3           319

Also: This is Ubuntu 14.04.1 LTS

closed as off-topic by user22815, Bart van Ingen Schenau, durron597, gnat, GlenH7 Jul 24 '15 at 21:25

  • This question does not appear to be about software engineering within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    Have you looked at the contents of irb? Its quite readable and could easily be quite a bit smaller. I would also point out that ruby (on my system) is 34kb, while perl and python are 58kb each (only differing by 16 bytes). This is likely more a question of "what shared libraries are they using" than "why is it so small"? – user40980 Jul 24 '15 at 0:03
  • 3
    Size matters not. Look at me. Judge me by my size, do you? Hmm? Hmm. – Robert Harvey Jul 24 '15 at 0:34
  • You sure irb is not a symlink? My Ruby, Python and Perl interpreters are all a lot bigger than that (and @MichaelT's versions) but the symlinks are a couple of KB. – user22815 Jul 24 '15 at 3:38
  • 3
    I'm voting to close this question as off-topic because it is not a conceptual programming problem. – user22815 Jul 24 '15 at 3:39
  • @Snowman: the size of the IRb binary looks about right. It typically contains only three lines, the shebang and require "irb"; IRB.start(__FILE__), plus some copyright and version notices. The version in the YARV Git repository is 161 bytes, the version shipped with OS X 10.10 is 363 bytes. So, 319 bytes looks perfectly okay. – Jörg W Mittag Jul 24 '15 at 9:27

This is really hard to answer, because a ton of information is missing:

  • How did you measure those sizes? Do they include libraries required to run the interpreter? Do they include runtimes?
  • What Python implementation are you talking about? There are four production-ready implementations of Python in current use (PyPy, IronPython, Jython, CPython), plus Stackless Python, plus a couple of not-production-ready ones (e.g. Pynie).
  • What Ruby implementation are you talking about? There are six production-ready implementations of Ruby in current use (Rubinius, MagLev, JRuby, MRuby, YARV, plus MRI, which is no longer being developed but is still being used), plus the abandoned MacRuby and IronRuby, plus the in-development Topaz, Cardinal, and many others.

For example, you count this as the entire size of irb:

#!/usr/bin/env ruby
#   irb.rb - interactive ruby
#       $Release Version: 0.9.6 $
#       $Revision$
#       by Keiju ISHITSUKA(keiju@ruby-lang.org)

require "irb"


So, you do not include the size of the IRb library, nor the size of the other libraries of the standard library which IRb uses, nor the size of the Ruby core library, nor the size of the Ruby interpreter, nor the size of any libraries the Ruby interpreter uses, nor the size of any runtime services the Ruby interpreter might use, nor the size of any operating system components, kernel systems, hardware drivers, etc. that the interpreter might need to operate. You count only those two lines of code as the entire size of IRb.

Not the answer you're looking for? Browse other questions tagged or ask your own question.