Chapter 20. Ruby's future

Blue Chapter -- Machine Translation

issues to be resolved

ruby "I completed the software" is not. Still developing, , With many problems. First, inherent in the current interpreter Let's remove the problem. The order of discussion about this chapter in accordance with the order.

GC performance

GC's current performance is "particularly bad lately, but not particularly well" and said it would be ? "Not bad, especially" the "daily life is not annoyance", "In particular good or not" is "a heavy load and weaknesses that expose the" means . For example, large number of objects be preserved and continue to make application. Applications that speed is rapidly declining. GC object to mark all the time It will be the object is capable of a further recovery in the number of times GC Increasing it from. This issue is mentioned in Chapter 5 GC is a different generation effects Fruit and should be (at least in theory, I think that is.)

The reaction in terms of speed and there is room for improvement. The current interpreter is running all the GC Because the body stops, editor GUI application that seems at times "ぐっ" Polarized reaction is to be interrupted. For example, it will have about 0.1 seconds, Type the characters or the middle止まらa very bad impression. It is now UIU application is not made, or as large as some of MOSA ITAME This is not a problem to have. But one thing that came out It will introduce incremental GC might need to consider.

parser implementation

As seen in the second part ruby parser implementation is Already yacc overuse close to the limit, and to tolerate any further extension of the stranger . If you do not have expansion plans but, after this "keyword argument" The big game is scheduled to be introduced to, yacc restrictions because I want to express and grammar Not what it would be sad.

parser reuse

Ruby parser is very complicated. In particular lex_state around to seriously deal with It is very difficult. Because of that, Ruby or embed program, Ruby program to handle the program itself is very difficult.

For example, the author is developing a tool racc everything. yacc version of Ruby As so R racc . The racc grammar, syntax and file is almost yacc and the same, Action is only a portion of the Ruby code. It is Ruby's Coe Do not properly Perth unable to determine at the end of the action, "Chan "It is very difficult to parse. I have no choice but to "roughly" in Perth, Out a compromise that level.

Ruby analysis of other programs as examples the need to indent and lint tools such as Cited, as well as to make this very difficult time. Refactoring Tools such as the complex no longer think it will be hopeless.

Then how? The same thing is impractical to re-create, ruby original Parser can be used as components do I not? In other words treatment Parser system, but the library itself. This is a function of whether I want both.

But the problem here is, yacc parser to use as long as we do not re-entrant It. In other words yyparse () on recursion, or from multiple threads Call or not. So Ruby in Perth to return control to fruit Must be binding.

Hiding

number

Current ruby move the program's source code is not動かせない. That is another source code to know the reason why people who do not want to read.

interpreter objects

Current ruby only one interpreter to handle the process, it is In Chapter 13. More than one interpreter with the reality that it can be It is like if you already have, that's not really possible to implement. ?

evaluator structure

Existing eval.c is just too complicated. Ruby's stack machine SUTAKKUFURE The embedding system also find troubling the original software, setjmp () longjmp () overuse and abuse of WAKARIYASUSA down and speed. In particular, many RISC machines that register setjmp () overuse and abuse and speed down easily. setjmp () , to register all To take shelter.

evaluator speed

ruby is usually used BUN is already fast enough. But still, language processing Fast system is undoubtedly the faster the better. To speed up, namely the optimization How do I do? That's when the first profile will be採らね . So採った.

 
   % Cumulative self self total 
  time seconds seconds calls ms / call ms / call name 
  20.25 1.64 1.64 2638359 0.00 0.00 rb_eval 
  12.47 2.65 1.01 1113947 0.00 0.00 ruby_re_match 
   8.89 3.37 0.72 5519249 0.00 0.00 rb_call0 
   6.54 3.90 0.53 2156387 0.00 0.00 st_lookup 
   6.30 4.41 0.51 1599096 0.00 0.00 rb_yield_0 
   5.43 4.85 0.44 5519249 0.00 0.00 rb_call 
   5.19 5.27 0.42 388066 0.00 0.00 st_foreach 
   3.46 5.55 0.28 8605866 0.00 0.00 rb_gc_mark 
   2.22 5.73 0.18 3819588 0.00 0.00 call_cfunc 

This is when you move a certain application of the profile, but in general Ruby-profile program reasonably close. That is an overwhelming percent of the top If, rb_eval () appeared, after the nerve centers of the GC and Evaluation System, in addition to specific treatment The function is mixed. For example, if the application is a regular expression match ( Ruby_re_match ), it takes a considerable time.

But as it was found or how to resolve the problem. Given the simple rb_eval () faster, I do, that will happen, ruby core Optimization is about superficial there has been little to do. NODE_IF of Like those used by "at the end of reflexive → goto conversion," with little sense of himself out pike There is. That is fundamentally changing the way the idea as long as there is no room for improvement.

thread implementation

But this is the chapter 19. Ruby's current implementation is very thread Face many problems. In particular, poor chemistry between native and can do little. ruby thread (1) is highly portable (2) Where the same behavior, will make a two-point Other advantages of the crab's hard to replace, but the implementation is much more that they continue to use non - There might be reasons.

ruby 2

Now these are followed by the original problem ruby of trends.

Rite

Currently, the ruby is the latest stable version is 1.6.7, 1.7.3 version is developed. But following the not too distant future there might be a stable version is 1.8. Then the same time Version 1.9.0 of the development starts. And the following is a little off-key 1.9.1 Stable.

stable development version start time
1.6.x 1.7.x 2000-09-19 to release 1.6.0
1.8.x 1.9.0 six months is going to
1.9.1 ~ 2.0.0 two years after long

And the development of next-generation version of ruby 2, code-named Rite,. The name of the L and R to the Japanese people can not distinguish between discipline OMAJURASHII.

In short, or 2.0 What is the change and said, almost all of the core. The conversation, evaluation Instruments, parsers, this is all changing. However, that number has emerged not KAKERA This is just to write it all "future". Do not hold too much disappointment One might. So, expect light, let me say that.

description language

First use of language. C definitely. Ruby mailing list of English ruby-talk in Matsumoto's statement said.

I hate C + +.

DASOU so, C + + is the first to use with BE. Even with a full makeover I also object system is believed to remain so near the Oh Or an ounce of effort it requires. But this time, however C is the ANSI C to C The potential is high.

GC

GC implementation, First Boehm GC \ footnote (Boehm GC http://www.hpl.hp.com/personal/Hans_Boehm/gc ) from Try it. Boehm GC is GC-generational and conservative and incremental, and Native and is not working All of the stack to mark the thread that a lot of good things Oh, GC Be. Once introduced as a Boehm GC whether to continue using it or leave Do not know, either, a certain direction can be expected to speed Forward.

parser

In terms of specification, omitted parentheses method call it nesting, and uniform ban U. Seen as command_call grammar throughout considerable influence and Hoops. This is simplified if the scanner is also very parser should be refreshed. However omitted parentheses itself is no longer impossible.

In terms of the implementation yacc whether to continue using it still dwell in it. Use Handwriting and do not, they say, that only complicated things by hand implemented Or of the anxiety remains. Which to choose the cusp of the road must have.

evaluator

Evaluator and is completely re-creation. The main purpose is to speed up and simplify the implementation of the A second point of focus.

First rb_eval () eliminate recursion. How to eliminate the "tail recursion → goto conversion, "like, say is the most intuitive? One rb_eval () in goto using coiled around it. The first function called Will drop out and, return and break used for setjmp () they do not need them Be. However C defined by the method call is in, but do not function known as the Opera House Because of a rule that still separated setjmp () is necessary.

Bytecode (byte code) YOUSURUNI is like a machine-language program It. Smalltalk80 made famous in the virtual machine parlance, by instruction With units that are configured so called bytecode. Just had on the level Human beings from the ATARIMAE bytes is not felt to them, but Machine language instruction is a bit of a unit that is. For example, Alpha and instruction. Back among the 32-bit code is 6-bit instruction shows that species.

Byte-code the main advantage is speed. There are two reasons, first is a syntax Pointer to haul the tree is not necessary. Another is local optimization (Peephole optimization) is easier.

The number of bytes to store and make sure that if you read it because it runs out in Perth It is also believed to be a little bit faster. But the program begins in Perth Only once does not work, the original Perth is not much time So I have no major impact.

Bytecode evaluator's going to be or want to know if regex.c to look at And be good. After the Python is BAITOKODOINTAPURITA.

thread

The thread is a native countries. Ruby was born in 1994, compared with the time The conversation surrounding environment is much better and the native, Able, as judged by them.

It is native to use the C levels in a preemptive MARUCHISUREDDOSEFU itself, but from the interpreter must be, The point is to lock in the meantime resolve the global market.

That, and to people in the know "continuous" But I am afraid signs of running out. ruby of The conversation is continuing to implement because it depends heavily on a threadネイティブスレッ DE will be a continuation of nature and disappear. That indicates that the "implementation of it I "to it now, because we have not used in almost any problems.

M17N

Class libraries in passing let me mention just a few. Multilingualization (Multilingualization, for short M17N) matters. Programming M17N What do you make a tangible thing about it and to handle multiple character code You can.

There are other topics like globalization (Internationalization, for short I18N) and I would also Be. This example, if an error in a user's preferred language Resona, the date of expression to a national convention along with them. For example, to see that this And, I18N to achieve the realization of M17N is essential. But the reverse is not made of .

Specifically Ruby was multilingualized So what do you need? Part of the deal parser, and Another is related to a string library, specifically the String and Regexp response, Two are needed.

Parser is available for comment and a string literal, literal representation of any regular language (Encoding to be exact) to forgive.易しThis is so difficult. First, ruby the parser Encoding method is needed to tell. Ever seen. Ruby mentioned programs are left to wander without exception parser evaluated. That is par Sa encoding syntax to convey, but usually can not use. So Encoding syntax to specify the need to add some.

Library fairly easy to handle. Currently mbclen () a mechanism to Obediently extension of what they are.

M17N corresponding ruby has already been implemented, CVS repository ruby_m17n branch Available. Incorporated into the implementation of the specifications are not mature and a Say to the judge. If a good interface design even in the middle 1.9 But to get to be.

IO

Ruby's current IO class is a simple stdio , but the wrapper, This approach is

There was dissatisfaction with the two points. So, Rite stdio to own a Particularly likely.

Ruby Hacking Guide

We are always here ruby from the outside to act as an observer. But HEART RON ruby products to be included in the display case is different. That is our actions to help So here we can influence. This last clause of the communities NITI from the proposed ruby talking about lobbying for the current and future We餞Ruby Hacker said.

generation GC

First, mentioned in Chapter 5, Masato Kiyama's another generation of the GC. Patches have already said that the current street

That's the problem, but this place is the first large-scale informal patch Above all, the point to a high rating.

Oni

car

Ruby is now using the regular expression engine is revamped version of the GNU regex. The GNU regex was originally written for Emacs, and it multibyte In addition to the Perl-compatible matz has reshuffled. Easy from the back As one can imagine a very complex structure of the horror of it. The GNU regexp LGPL license because ruby license is very slightly It has strainer, KANETEKARA is an issue of this engine has been replaced.

Then suddenly appeared in the hands of Kiyomi Kosako's regular expression engine "car ogre" . This is done quite YOIRASHIKU,取りこまsoon as it is likely to itself.

The film's car ruby CVS repository should do the following available.

 
% Cvs-d: pserver: anonymous@cvs.ruby-lang.org: / src co oniguruma 

ripper

Followed by a little thing of mine-ripper. parse.y make modifications to the extension of the library. ruby body does not mean any changes in the components of the parser One direction as to keep here.

Stream interface system implemented in the token of the scan. Parser that the reduction in the event that you can pick up a form. CD-ROM attached to it We \ footnote (ripper: the accompanying CD-ROM archives/ripper-0.0.5.tar.gz ) so Try me. In addition, this version is six months ago ruby 1.7 - And so today is somewhat different grammar.

This is just a scratch, "recalled his idea" that is the reasonだっ And that, in spite of that I think it worked. Implement real-time or three days or so With a quick.

alternative parser

Still nowhere to be seen, but the product, ruby is totally independent and can be used Ruby parser written in C + + Some people are like ( [ruby-talk: 50497] ).

JRuby

More radical, rewrote the entire interpreter Well, The movement. For example, written in Java Ruby "JRuby \ footnote (JRuby http://jruby.sourceforge.net )" It appeared that. Here's Jan Arne Petersen, Quite a large family seem to be implemented.

I had the impression of a little

It is going to say. Incidentally, the last "slow" or how to say, The original ruby 20 times as much (running time). So far slower and sour Is difficult. But on the Java VM Ruby VM is running from it,遅くない Definitely not. Machine is 20 times faster to wait for only one who ARUMAI.

But imagine a whole is far from well, being impressed.

NETRuby

But if you work with Java, C # work. So I wrote C #, Ruby, "NETRuby \ footnote (NETRuby http://sourceforge.jp/projects/netruby/ )" It appeared. The author is arton's.

I was in the hands. NET environment is not only the source code have not seen it, According to the valve himself

Everything around me is the問題らしい. But instance_eval 動くらしいis (surprise).

ruby contributing to the development

ruby developers, who are just personal Yukihiro Matsumoto, final ruby about the direction of absolute power. At the same time ruby is Open Source Software, and anyone can participate in the development. Participate, It is the opinion of the proposal or patches can be out of it. The participants how to speak in concrete.

ruby If the mailing list, mainly because it developed into each MERIN Grist is good to participate. Currently the center of the community MERI Is NGURISUTO ruby-list , ruby-dev , ruby-talk three. ruby-list is "Ruby NANDEMO related to it, OK" mailing list, and Japanese. ruby-dev is a development version ruby talk about the mailing list, which also concerned Japanese Be. ruby-talk mailing list is in English. How do the Ruby The official site \ footnote (Ruby's official website: http://www.ruby-lang.org/ja/ ) "Mailing list" page of the list. These lists How many members are welcome also read it, just try to participate in a while Discussions with a view, make the atmosphere MUTOIINODEHANAIDAROUKA.

But Ruby from Japan, began on a more "initiative is ruby-talk moved" Told me not to let them. But development is still the center ruby-dev that has not changed. Of course ruby have to commit human rights (ie, the core members) are mostly Japanese Do not bother, so users can speak English like the idea of the nature and ruby-dev suitable for walking . Core members of the future using English is increasing and it will situation may change Still, for the duration ruby development is the core ruby-dev .

But Japanese can not participate in the development does not work and that troubles me is we are ruby-dev summary of the English once a week ruby-talk have to be bygones Be. I also participate in the summary that it is now a revolving three Do you have a very stringent. Summary of the permanent members to help him NOW. I think it is whether we KATAHA ruby-list , participants expressed their I would like.

Finally, if the source code for software that is not good. Website maintenance and other documents is also needed. And that's not The lack of someone who is always GIMI. ICHIOU activities related documents only mailing list also has an TORIAE ZU is ruby-list "want to do something", saying it would be good. I can do. Only answer to the other members reacted to it.

last

Well, that's a long time in this document. Pages Oh, so that in mind Part of a carefully-called minute is not the overall champion, ruby for the foundation All the talk himself out. UDAUDA further to add that the rest tone. Still WAKARA If you have not convinced until he read the source code to find out.


The original work is Copyright © 2002 - 2004 Minero AOKI.
Translations,  additions,  and graphics by C.E. Thornton
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike2.5 License.