D
Devin Mullins
Devin said:(namely, heap size)
Err... did I say heap size? 'Cause I meant stack size. Yeah, that's the
ticket...
Devin
Devin said:(namely, heap size)
I just provided that functionality, see below:Isaac said:Complaining that it's wrong for Python to provide functionality that
allows the program to run is simply bizarre. The problem is that Ruby
doesn't provide that functionality.
From: "Isaac Gouy said:Complaining that it's wrong for Python to provide functionality that
allows the program to run is simply bizarre. The problem is that Ruby
doesn't provide that functionality.
Florian said:I just provided that functionality, see below:Isaac said:Complaining that it's wrong for Python to provide functionality that
allows the program to run is simply bizarre. The problem is that Ruby
doesn't provide that functionality.
def ack(m, n)
if m == 0 then
n + 1
elsif n == 0 then
ack(m - 1, 1)
else
ack(m - 1, ack(m, n - 1))
end
end
if ARGV.size < 2
require 'rbconfig'
include Config
system "ulimit -s 100000; #{File.join(CONFIG['bindir'],
CONFIG['ruby_install_name'])} #$0 #{$*[0]||9} foo"
else
NUM = Integer(ARGV.shift)
print "Ack(3,", NUM, "): ", ack(3, NUM), "\n"
end
Will you complain now or change the Ruby script to use this
functionality, that allows the program to run?
Bill said:From: "Isaac Gouy said:Complaining that it's wrong for Python to provide functionality that
allows the program to run is simply bizarre. The problem is that Ruby
doesn't provide that functionality.
Since the shootout purports to be about measuring performance,
it seems a smidge over-picky to disallow a program on the
basis of a non-performance-related environment configuration
issue.
If you're on a unix system, and you really wanted to, you could
add this ugly line to the start of the script:
ENV['FIXSTACK'] = "1" and exec(%{/bin/sh -c "ulimit -s unlimited ; exec ruby #$0 #{ARGV.join(' ')}"}) unless ENV['FIXSTACK']
It'll fix the environment problem and won't even change the
process ID.
Note that it should also be possible to call setrlimit()
directly from ruby, using the built-in 'dl' library.
The 'dl' library works on windows too, so the appropriate
win32 routine should also be callable directly from ruby.
In other words, it _can_ be solved directly from ruby. But
it's an environment issue that, whether addressed in the
shell prior to calling the ruby program, or handled in ruby
itself via the kludge above, or in ruby via a system call using
the 'dl' library, neither affects the program run-time nor memory
usage in a significant way. Since it's not a performance-
related issue, disqualifying a program based on an incorrectly
configured environment seems peculiar.
If you want to see the direct system call from ruby using
the 'dl' module, let me know. I think it'd be three lines or
so.
Regards,
Bill
Here's how to contribute your program
http://shootout.alioth.debian.org/faq.php?sort=3Dfullcpu#contribute
Devin said:I think his argument is grounded, here. (No presupposition on his other
arguments; I don't particularly care, let alone know.) Many would
consider it a flaw that Python allows programs to escape the parameters
(namely, heap size) with which they were initiated. Ruby _does_ provide
the functionality that allows it to run, but leaves it up to the
launcher, and makes the matter unchangeable at runtime.
Devin
Austin said:Assuming that you actually care, look it up on the archives. The text
has not improved since the last time we talked about the alioth
shootout.
No, the problem is that you don't *run* the Ruby program with an
expanded stack size. Matz has chosen to not make this available within
Ruby. This is *not* a flaw. The problem is your test script, not the
Ruby script. You've been told this for nine months now.
Perl#4 is the only one that actually implements the function in a
readable and usable way. Perl (unlabeled) implements it in a way that
acknowledges that it's a cheat nearly as much as the two alternatives
(#2 and #3).
Incorrect. With a *single* shell command, I can make the Ruby
Ackermann run perfectly (and, IIRC, better than the Python equivalent,
or at least to deeper recursion depths even with the Python language
"cheat"). This isn't undocumented; this has been mentioned to you
since January. It has *nothing* to do with the implementation of the
Ruby Ackermann, but the default stack size allocated to the Ruby
process. It's more restrictive under Windows, and that is probably a
compile-time option, but again -- it's *not* a Ruby problem. It's a
problem in your methodology and your assumptions. If you've screwed up
there, where *else* have you screwed up?
Austin said:Obviously, you didn't even read the program to see that it was an
utter cheat to exec the program. The right solution -- as always --
for you to fix your damned run script. Fix that and you'll get results
for the Ruby program AS IT STANDS.
Don't fix it, and my assessment of the lack of honesty surrounding the
Bogus Computer Language Shootout stands.
-austin
So?Isaac said:Devin Mullins wrote:
Seems like Billy Kelly and Florian Frank think Ruby has the same
functionality as Python - which "many would consider it a flaw"?
I implicitly trust Ruby programmers - it's simply unthinkable that any
of them would contribute a program which intentionally cheated. (And
it would give the Perl guys something to complain about.)
Martin DeMello suggested collecting complaints on a wiki page, so every
3 weeks when someone asks about Ruby performance on the shootout, they
can simply be directed to all the complaints you've already made.
If for some reason you don't feel able to mention the "text that makes
a lie of everything you claim about the site" here - just savage it on
the wiki page.
http://rubygarden.org/ruby?BenchMarks
More abuse? So much for Martin Fowler's Ruby People meme.
Is there seem reason the approaches suggested by Bill Kelly and Florian
Franks are unacceptable?
Bill Kelly said:Note that it should also be possible to call setrlimit()
directly from ruby, using the built-in 'dl' library.
From: "Tanaka Akira said:Also note that Ruby 1.9 has Process.setrlimit.
From: "Bill Kelly said:I tried to make the call with 'dl', but I'm getting an
error:
(eval):2:in `setrlimit': undefined method `[]' for nil:NilClass (NoMethodError)
from rlimit2.rb:16
And C doesn't rot your brain? C'mon...
Write the whole thing in Ruby (or whatever language you find most
productive). Test it (and write test cases), verify its correctness.
Then _if_ it is too slow profile it, locating the bottlenecks. Last
step is then to speed up that small portion of critical path code
(located by profiling, not guessing) and optimize the algorithm and/or
the implementation (possibly rewriting a portion in C).
From: "Bill Kelly said:I tried to make the call with 'dl', but I'm getting an
error:
(eval):2:in `setrlimit': undefined method `[]' for nil:NilClass (NoMethodError)
from rlimit2.rb:16
Austin said:No, Isaac, I'm not going to do your homework for you anymore.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.