[#365153] synchronize a "mocked" clock in a distributed system — Chuck Remes <cremes.devlist@...>

I've been banging on a problem for a few days now and don't feel any closer to solving it. I'm hoping some of the big brains on the ruby ML can shed some light. Following are a few paragraphs with a brief system overview before I state the problem. I apologize in advance for this question being only tangentially related to Ruby the language. :)

13 messages 2010/07/01
[#365164] Re: [Q] synchronize a "mocked" clock in a distributed system — Tony Arcieri <tony.arcieri@...> 2010/07/01

On Thu, Jul 1, 2010 at 3:10 PM, Chuck Remes <cremes.devlist@mac.com> wrote:

[#365214] RubyGoLightly Progress Report — Eleanor McHugh <eleanor@...>

I seem to have been missing in action for the best part of six months so =

14 messages 2010/07/02

[#365320] Why am I not getting the expected output? — Abder-rahman Ali <abder.rahman.ali@...>

I have the following code: http://pastie.org/1032525, but always getting

11 messages 2010/07/06

[#365351] best way to make .rb into an executable for linux? — David Ainley <wrinkliez@...>

I have a pretty basic .rb script that I would like to turn into an

11 messages 2010/07/06

[#365374] Hashes don't allow preceding commas by design? — Iain Barnett <iainspeed@...>

This is the output from irb that shows ruby 1.9.1 doesn't like hash =

12 messages 2010/07/07

[#365413] What is meant by those lines of code in this script? — Abder-rahman Ali <abder.rahman.ali@...>

I came across the following script from "Why's poignant guide to Ruby".

9 messages 2010/07/07

[#365504] FIRST PROGRAMMING PROBLEM Array — Francisco Martinez <calabazag@...>

Hi...I'm trying to solve a very simple exercise but this is one of my

12 messages 2010/07/09

[#365513] what about allowing to specify, which end belongs to which start? — Jan Lelis <prog@...>

Hi Ruby mailing list,

24 messages 2010/07/09
[#365541] Re: what about allowing to specify, which end belongs to which start? — Caleb Clausen <vikkous@...> 2010/07/10

On 7/9/10, Jan Lelis <prog@janlelis.de> wrote:

[#365548] Re: what about allowing to specify, which end belongs to which start? — Robert Klemme <shortcutter@...> 2010/07/11

On 10.07.2010 17:54, Caleb Clausen wrote:

[#365551] Re: what about allowing to specify, which end belongs to which start? — Caleb Clausen <vikkous@...> 2010/07/11

On 7/11/10, Robert Klemme <shortcutter@googlemail.com> wrote:

[#365555] Re: what about allowing to specify, which end belongs to which start? — Robert Klemme <shortcutter@...> 2010/07/11

On 11.07.2010 13:32, Caleb Clausen wrote:

[#365574] Re: what about allowing to specify, which end belongs to which start? — Caleb Clausen <vikkous@...> 2010/07/11

On 7/11/10, Robert Klemme <shortcutter@googlemail.com> wrote:

[#365570] How to pass a hash as a param to a method called through eval? — Alex Stahl <astahl@...5.com>

Hi Folks - I've got a data-driven app I'm building, and I'd like to be

14 messages 2010/07/11

[#365615] Try Ruby is back online. — andrew mcelroy <sophrinix@...>

Greetings,

10 messages 2010/07/12

[#365721] Ruby garabage collector — Abder-Rahman Ali <abder.rahman.ali@...>

In the "Why's poignant guide to Ruby" book, it states the following:

22 messages 2010/07/13

[#365752] What does this do? — Abder-Rahman Ali <abder.rahman.ali@...>

I have this portion of code from "Why's poignant guide to Ruby" book.

12 messages 2010/07/13

[#365828] click a javascript dialog window in Firefox — Mario Ruiz <tcblues@...>

Hi,

9 messages 2010/07/14

[#365844] Return nothing when looking outside the bounds of 2D array? — Shawn W_ <shawnw@...>

I have a 2D Array. I have written a method

22 messages 2010/07/14
[#365850] Re: Return nothing when looking outside the bounds of 2D array? — w_a_x_man <w_a_x_man@...> 2010/07/14

On Jul 14, 3:56=A0pm, Shawn W_ <sha...@internode.on.net> wrote:

[#365853] Re: Return nothing when looking outside the bounds of 2D array? — Shawn W_ <shawnw@...> 2010/07/15

Thx. Don't quite understand that code. I tried plugging in some nils but

[#365869] Re: Return nothing when looking outside the bounds of 2D array? — Shawn W_ <shawnw@...> 2010/07/15

A better way to describe it.

[#365871] Re: Return nothing when looking outside the bounds of 2D array? — Dave Howell <groups.2009a@...> 2010/07/15

I was going to suggest using the 'case' statement instead of all those =

[#365938] Re: Return nothing when looking outside the bounds of 2D array? — Shawn W_ <shawnw@...> 2010/07/16

Okay, just found out that...

[#365944] Re: Return nothing when looking outside the bounds of 2D array? — Martin DeMello <martindemello@...> 2010/07/16

On Fri, Jul 16, 2010 at 11:11 AM, Shawn W_ <shawnw@internode.on.net> wrote:

[#365847] Ruby best practice for "always on" app/service? — yermej <yermej@...>

I'm building an app that will essentially be a web service client. It

10 messages 2010/07/14

[#365988] client-side Ruby on iPad/iPhone? — Jeff Pritchard <jp@...>

I've seen jRuby and IronRuby, and really want to use them since i really

12 messages 2010/07/17

[#366015] ruby abstraction — "James O'Brien" <jeob32@...>

Hi,

17 messages 2010/07/18

[#366053] LoadError: no such file to load -- tk — Rich Leblanc <rl001@...>

I'm trying to install Ruby on a 64 bit Windows 7 machine following this

46 messages 2010/07/19
[#366063] Re: LoadError: no such file to load -- tk — Roger Pack <rogerpack2005@...> 2010/07/19

[#366082] Re: LoadError: no such file to load -- tk — Rich Leblanc <rl001@...> 2010/07/19

Roger Pack wrote:

[#366085] Re: LoadError: no such file to load -- tk — Eric Christopherson <echristopherson@...> 2010/07/19

On Mon, Jul 19, 2010 at 3:26 PM, Rich Leblanc <rl001@pacbell.net> wrote:

[#366086] Re: LoadError: no such file to load -- tk — Rich Leblanc <rl001@...> 2010/07/20

Eric Christopherson wrote:

[#366135] Re: LoadError: no such file to load -- tk — Roger Pack <rogerpack2005@...> 2010/07/20

[#366140] Re: LoadError: no such file to load -- tk — Rich Leblanc <rl001@...> 2010/07/20

Roger Pack wrote:

[#366147] Re: LoadError: no such file to load -- tk — Roger Pack <rogerpack2005@...> 2010/07/20

Rich Leblanc wrote:

[#366153] Re: LoadError: no such file to load -- tk — Rich Leblanc <rl001@...> 2010/07/20

Roger Pack wrote:

[#366179] Re: LoadError: no such file to load -- tk — Rich Leblanc <rl001@...> 2010/07/21

Rich Leblanc wrote:

[#366115] Count occurences of vars in array — Vitaliy Yanchuk <fuksito@...>

Hello, everyone.

18 messages 2010/07/20
[#366116] Re: Count occurences of vars in array — Jean-Julien Fleck <jeanjulien.fleck@...> 2010/07/20

Hello,

[#366120] Re: Count occurences of vars in array — Vitaliy Yanchuk <fuksito@...> 2010/07/20

Jean-Julien Fleck, thanks.

[#366152] Can't get ruby 1.9 to work after install on OSX — Musdev Musdev <devrubygem@...>

Hello

12 messages 2010/07/20

[#366196] how to make "gem install rmagick" work? — Jian Lin <blueskybreeze@...>

I wanted to install rmagick on Win7 but it can't install:

10 messages 2010/07/21

[#366226] Text to Binary — Umm Whyshouldisay <kipthemudkip@...>

Hi! I'm new to the forums. I'm also a bit new to Ruby. I already know

13 messages 2010/07/21

[#366254] finding last line in a file — Ted Flethuseo <flethuseo@...>

Hi everyone,

15 messages 2010/07/22
[#366256] Re: finding last line in a file — Urabe Shyouhei <shyouhei@...> 2010/07/22

Take a look at the doc for File.readline.

[#366257] Re: finding last line in a file — Urabe Shyouhei <shyouhei@...> 2010/07/22

(2010/07/22 14:08), Urabe Shyouhei wrote:

[#366319] Typical Ruby (non-rails) project structure. — Carl Jenkins <carljenkins@...>

What is/are the best-practice(s) for a Ruby project structure?

18 messages 2010/07/22

[#366418] Ruby books designed especially for beginngers — Kaye Ng <sbstn26@...>

Hey experts, i need your advice.

12 messages 2010/07/24

[#366611] Which Ruby is in use? — Hassan Schroeder <hassan.schroeder@...>

Is there a way to tell from within a program which executable is being

23 messages 2010/07/27
[#366614] Re: Which Ruby is in use? — "Joseph E. Savard" <joseph.savard@...> 2010/07/27

[#366617] Re: Which Ruby is in use? — Hassan Schroeder <hassan.schroeder@...> 2010/07/27

On Tue, Jul 27, 2010 at 2:20 PM, Joseph E. Savard

[#366620] Re: Which Ruby is in use? — Joel VanderWerf <joelvanderwerf@...> 2010/07/27

Hassan Schroeder wrote:

[#366622] Re: Which Ruby is in use? — Hassan Schroeder <hassan.schroeder@...> 2010/07/27

On Tue, Jul 27, 2010 at 3:10 PM, Joel VanderWerf

[#366624] Re: Which Ruby is in use? — Joel VanderWerf <joelvanderwerf@...> 2010/07/27

Hassan Schroeder wrote:

[#366625] Re: Which Ruby is in use? — Hassan Schroeder <hassan.schroeder@...> 2010/07/27

On Tue, Jul 27, 2010 at 3:52 PM, Joel VanderWerf

[#366626] Re: Which Ruby is in use? — Joel VanderWerf <joelvanderwerf@...> 2010/07/27

Hassan Schroeder wrote:

[#366629] tool to compare DB schema against DDL file — Fabian Marin <fmg134s@...>

First of all any feedback from you guys will be of tremendous help.

14 messages 2010/07/28

[#366727] my script just read one line? — Junhui Liao <junhui.liao@...>

Dear all,

19 messages 2010/07/29
[#366729] Re: my script just read one line? — Jes俍 Gabriel y Gal疣 <jgabrielygalan@...> 2010/07/29

On Thu, Jul 29, 2010 at 1:43 PM, Junhui Liao <junhui.liao@uclouvain.be> wro=

[#366766] Re: my script just read one line? — Junhui Liao <junhui.liao@...> 2010/07/29

Dear Jes炭s Gabriel y Gal叩n and all,

[#366774] Re: my script just read one line? — Jes俍 Gabriel y Gal疣 <jgabrielygalan@...> 2010/07/30

On Fri, Jul 30, 2010 at 1:58 AM, Junhui Liao <junhui.liao@uclouvain.be> wro=

[#366784] Re: my script just read one line? — Junhui Liao <junhui.liao@...> 2010/07/30

[#366786] Re: my script just read one line? — Jes俍 Gabriel y Gal疣 <jgabrielygalan@...> 2010/07/30

On Fri, Jul 30, 2010 at 2:18 PM, Junhui Liao <junhui.liao@uclouvain.be> wro=

[#366792] Re: my script just read one line? — Junhui Liao <junhui.liao@...> 2010/07/30

Dear Jes炭s Gabriel y Gal叩n,

[#366755] .any?{} Behavior — John Sikora <john.sikora@...>

I find the following behavior interesting (so interesting that I

28 messages 2010/07/29
[#366797] Re: [].all?{} and [].any?{} Behavior — Rick DeNatale <rick.denatale@...> 2010/07/30

On Thu, Jul 29, 2010 at 5:27 PM, John Sikora <john.sikora@xtera.com> wrote:

[#366809] Re: [].all?{} and [].any?{} Behavior — Josh Cheek <josh.cheek@...> 2010/07/30

On Fri, Jul 30, 2010 at 10:49 AM, Rick DeNatale <rick.denatale@gmail.com>wrote:

[#366837] Mocking a method with a block — Fernando Guillen <fguillen.mail@...>

Hi people,

12 messages 2010/07/31

Re: re-organize original text data then write in files

From: Colin Bartlett <colinb2r@...>
Date: 2010-07-27 22:07:10 UTC
List: ruby-talk #366619
I'm putting this at the top of my post because I think the basic problem
here may be intensive numeric calculations, and - even more so - disk (inpu=
t
and) output of about 16 MiB x N bytes of data, where N is 8 bytes (? for
Floating point numbers), so about 128 MiB in total, and other people will
have a better knowledge of some possibly useful links.

On Sun, Jul 25, 2010 at 11:15 PM, Junhui Liao <junhui.liao@uclouvain.be>wro=
te:

> Actually, I developed two versions of C++ script.
> One is opening 4096 files at the same time. This cost 3 hours.
> Another version is saving all of the data in a big vector,
> then scanning the vector to pick the right items to write
> in files. This cost 2 hours and 45 minutes. :-).
>
Sorry - in my post I misunderstood what you meant by "cost". I think it is
(very?) unlikely that any Ruby (or Perl or Python, etc?) program will run
faster than your C++ scripts. Where Ruby (or Python - I'm not so sure about
Perl, I haven't used it) does have an advantage is that I think development
may be quicker. So there are trade-offs. (Incidentally, I'm not an expert,
but those timings suggest to me that the major processing cost may be in
writing the results out to disk, so changing the language for all or part o=
f
the processing is unlikely to make a large difference?)

But I'm open to correction: there are people who have used Ruby for fairly
intensive large data sets processing, but my understanding is that they use
a mixture of Ruby as "glue" with any intensive calculations in C, etc. For
example, from some limited experience I have the speed of Ruby reading
strings of bytes in from files is similar to the speed of Java or compiled
Pascal, but for calculating CRCs of files the speed of pure Ruby calculatin=
g
the CRCs once the bytes had read in was much slower than Java or compiled
Pascal: so I used Ruby (or rather JRuby) to read in the strings of bytes
from the files, and then called Java code from Ruby to calculate the CRC
from the bytes. Overall the speed of this was similar to a pure Java or pur=
e
compiled Pascal program.

Piet Hut and Jun Makino have been using Ruby to model dense star clusters.
(Note that this is something I know nothing about! I'm just intrigued by th=
e
underlying principle of using Ruby for intensive numerical calculations by
developing in Ruby without worrying about speed by using smaller unrealisti=
c
models, and then using more realistic models by translating part (or all!)
of the Ruby code to a faster language.)

http://www.kira.org/index.php?option=3Dcom_content&task=3Dview&id=3D124&Ite=
mid=3D154
...MODEST is the new name for the Stellar Dynamics workshop. It stands for:
MOdeling DEnse STellar systems
...
The basic idea is to start a kind of N-body wikipedia, as a group's process=
.
It should be self contained, a place to gather all the basic information
that is currently missing from the literature. Up till now, if you want to
write a decent N-body code from scratch, you have to somehow catch the oral
knowledge that is floating around in the community, most of which has never
been written down. We want to change that.

One place to start is the open-source introductory text written over the
last several years by Piet Hut and Jun Makino, "Moving Stars Around"; see
http://www.artcompsci.org/#msa where we give pointers to two versions. The
older one is written using C++ and the newer one, with even more detailed
background, uses Ruby. We propose to use the basic text, and to translate
the (rather short) pieces of code into other languages, starting with LSL,
the Linden Scripting Language, and then to move on to OpenSim. ...

http://www.manybody.org/wiki/index.php/Moving_Stars_Around
http://www.artcompsci.org
http://www.artcompsci.org/kali/pub/msa/title.html
http://www.artcompsci.org/kali/pub/msa/ch16.html#rdocsect123
16.7. Conclusion

Dan: This confirms our earlier conclusions. At least on this particular
computer, that we are now using to do some speed tests, the unoptimized C
version takes 50% more time than the optimized version, the simplest Ruby
version takes about 50 times more time, the Ruby array version about 100
times more, and finally the Ruby vector version takes more than 250 times
more time than the optimized C version.

Carol: But even so, for short calculations, who cares if a run takes ten
millisecond or a few seconds? I certainly like the power of Ruby in giving
us vector classes, and a lot more goodies. We have barely scratched the
surface of all the power that Ruby can give us. You should see what we can
do when we really start to pass blocks to methods and . . .

Dan: . . . and then we will start drinking a lot of coffee, while waiting
for results when we begin to run 100-body experiments! Is there no way to
speed up Ruby calculations?

Carol: There is. By the time we use 100 particles, we are talking about 10^=
2
* 10^2 =3D 10^4 force calculations for every time step. This means that the
calculation of the mutually accelerations will take up almost all of the
computer time. What we can do is write a short C code for computing the
accelerations. It is possible to invoke such a C code from within a Ruby
code. In that way, we can leave most of the Ruby code unchanged, while
gaining most of the C speed.

Erica: I certainly like the flexibility of a high-level language like Ruby,
at least for writing a few trial versions of a new code. In order to play
around, Ruby is a lot more fun and a lot easier to use than C or C++ or
Fortran. After we have constructed a general N-body code that we are really
happy with, we can always translate part of it into C, as Carol just
suggested. Or, if really needed to gain speed, we could even translate the
whole code into C. Translating a code will always take far less time than
developing a code in the first place. And is seems pretty clear to me that
development will be faster in Ruby.

Dan: I'm not so sure about all that. In any case, we got started now with
Ruby, so let us see how far we get. But if and when we really get bogged
down by the lack of speed of Ruby, we should not hesitate to switch to a
more efficient language.


> ...
>
Thanks a lot for your encourage,
> I tried to read something on ruby already.
> Since this language is very simple and beautiful,
> no matter it works for my case or not.
> (But I hope it could be.)
>

To quote something Damon Runyon quoted/adapted: The race is not always to
the swift nor the battle to the strong - but that=92s the way to bet.
http://www.barrypopik.com/index.php/new_york_city/entry/the_race_is_not_alw=
ays_to_the_swift_no_the_battle_to_the_strong_but_thats_t/
Or to continue that analogy, "horses for courses"!
(Translation: for parts of a task that are heavy numerical processing a
"lower level" language is likely to be faster. That said, sometimes the
slower higher level language is fast enough: I was doing some actuarial
programming in JRuby, and intended to have some intensive numerical
calculations in Java. It turned out that JRuby was actually quite fast
enough for those particular calculations, although (for portability reasons=
)
I will be translating that numerical code from Ruby to Java.)

> Maybe it partly depends on what standard methods/functions are
> available: for example, in Ruby you can read a line from a file
> into a String, and then use a builtin method on the String
> to split it into an array of values using a specified delimiter,
> so in your case a space character?

> I need this kind of comment seriously, saying, what are the knowledge
>  which is necessary and enough to do my job. If there are some special
> and powerful methods or stances to do this kind of stuff.
> Or be better, give a example just very close my case.
> I can get the detailed by reading book(s) or googling.

For your particular problem you've already written the C++ code to do the
splitting and the processing, so (ignoring maintainability issues) I don't
think Ruby will speed up the development, and - for the reasons above - I
think it is unlikely to result in faster processing. But you might find it
worth looking at integrating Ruby (or Python or Perl) with C, C++ or Java
for other processing problems. I don't have any experience with C or C++,
but I have found integrating Ruby with Java fairly easily. (Once I found my
way round some initial misunderstandings I had with how to package Java to
be used by Ruby.)

Anyway, good luck with your task(s)!

In This Thread

Prev Next