For performance, write it in C#

I can’t resist jumping on this one. The attached file requires John
Lam’s
excellent RubyCLR library (http://www.rubyclr.com)

ruby latins.rb
user system total real
5 squares, ruby 4.156000 0.047000 4.203000 ( 4.235000)
5 squares, .net 0.594000 0.000000 0.594000 ( 0.719000)

Thanks to the Peter H. for his C version (on which I based the C#
version) and Simon Kroeger for the ruby code. All I/O was removed from
the
code to remove that factor from the timings. Sadly, I don’t have a c
compiler set up to time the original c version.

On 8/2/06, Justin B. [email protected] wrote:

I can’t resist jumping on this one. The attached file requires John L.'s
excellent RubyCLR library (http://www.rubyclr.com )

ruby latins.rb
user system total real
5 squares, ruby 4.156000 0.047000 4.203000 ( 4.235000)
5 squares, .net 0.594000 0.000000 0.594000 ( 0.719000)

The CLR is pretty badass, no doubt about it. I can’t say it’s better
than
Java because that violates my prime directive.

I have high hopes for the Ruby.NET project.

On 8/3/06, Peter H. [email protected] wrote:

Would this work with Mono?

John is hoping someone will help him answer that question. Right now its
Win32 only, but he thinks it should be possible.

Would this work with Mono?

On 8/3/06, Justin B. [email protected] wrote:

On 8/3/06, Peter H. [email protected] wrote:

Would this work with Mono?

John is hoping someone will help him answer that question. Right now its
Win32 only, but he thinks it should be possible.

Mono ought to work fine, especially for something like this that’s not
using
any crazy libraries.

I think the compiled binary might even “just work” with Mono, but I
haven’t
done any Mono dev in a while.

On 8/3/06, Charles O Nutter [email protected] wrote:

Mono ought to work fine, especially for something like this that’s not
using
any crazy libraries.

I think the compiled binary might even “just work” with Mono, but I
haven’t
done any Mono dev in a while.

Part of the problem the last time I looked at John’s code was that it
relied
on C++.NET to function as the glue between Ruby and C#. Also the last
time
I looked Mono did not have the capability to create this sort of hybrid
C++. I would love to be proven otherwise on both cases, but as of a
couple
of months ago there was not a lot of hope at a simple port to Mono.

In the cradle? I understand it has successfully passed all ruby 1.8.2
tests. I would think that means there’s quite a bit in there.

On 8/3/06, Tanner B. [email protected] wrote:

I looked Mono did not have the capability to create this sort of hybrid
C++. I would love to be proven otherwise on both cases, but as of a
couple
of months ago there was not a lot of hope at a simple port to Mono.

Ooops, you know you’re right…I think I misunderstood. I was talking
about
running the latin squares algorithm in pure C#, which would obviously
work
fine in Mono, but the OP was using RubyCLR…so yeah, I think Mono is
probably out.

I think someone’s gotten Ruby.NET to compile and run under Mono, but
that
project is still in the cradle. Still, it might do enough for this
calculation?

On 8/3/06, Michael T. [email protected] wrote:

In the cradle? I understand it has successfully passed all ruby 1.8.2
tests. I would think that means there’s quite a bit in there.

It’s managed to successfully run sample/test.rb in the standard
distribution, which does have a number of tests, but it’s far from a
full
suite. Much of Ruby.NET’s core classes are partially implemented or not
implemented at all. It’s got a good ways to go, but they’re making
progress.

I spent a lot of time with Miguel at Lang .Net this week, and what he
suggested was writing a script that would run runtime.dll through
ILDASM, and then strip out a whole bunch of P/Invoke goo that Mono
doesn’t understand (but which isn’t required to run) and then feed the
resulting .il file through ILASM.

This would neatly sidestep the need to write stuff in C# which would
rock.

Would someone out there be interested in taking up this challenge? It
shouldn’t be too hard to do …

Cheers,
-John
http://www.iunknown.com

On 8/4/06, John L. [email protected] wrote:

I spent a lot of time with Miguel at Lang .Net this week, and what he
suggested was writing a script that would run runtime.dll through
ILDASM, and then strip out a whole bunch of P/Invoke goo that Mono
doesn’t understand (but which isn’t required to run) and then feed the
resulting .il file through ILASM.

Even better - use Lutz Roeder’s Reflector.exe (
http://www.aisto.com/roeder/dotnet/) to disassemble Runtime.dll into C#
automatically. I looked at it this morning and it’s kind of messy but it
seems like a possibility.