[Mono-list] Array benchmark

2004-10-09 Thread Sijmen Mulder
On a game development forum, someone asked what method of storing 2D
arrays is faster. On .NET, there are three possibilities:

1. [y*width+x]
2. [x,y]
3. [x][y]

I was wondering too, so I wrote a benchmarker. I attached the source
and the results (as pdf). The results are remarkable!

With all methods with all resolutions, Mono -is- slowest. Until..
maximum optimalization is used. Then the Mono results are about 5
times as good as with Microsoft.NET. Another weird thing is that
normally, method 1 is way faster, but when Mono is used with maximum
optimalization, method 2 is faster. And when the version with a
resolution of a power of two is ran, both method 2 and 3 are faster.
Just take a look at the pdf :)

Could someone explain this odd behaviour? And why the speed difference
between non-optimized and optimized mono is so big? And why such
optimalization is not used by default?

-- 

 'May the Lord bless you and protect you. May the Lord smile on you
and be gracious to you. May the Lord show you his favor and give you
his peace.'
 'De Heer zegent je, en Hij bewaart je. De Heer kijkt met liefde naar
je, en Hij is je genadig. De Heer bedenkt het goede voor je, en geeft
je vrede.'

Sijmen Mulder
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Array benchmark

2004-10-09 Thread Michal Moskal
On Sat, Oct 09, 2004 at 11:29:21AM +0200, Sijmen Mulder wrote:
 On a game development forum, someone asked what method of storing 2D
 arrays is faster. On .NET, there are three possibilities:
 
 1. [y*width+x]
 2. [x,y]
 3. [x][y]
 
 I was wondering too, so I wrote a benchmarker. I attached the source
 and the results (as pdf). The results are remarkable!

Forgot the attachment?

 With all methods with all resolutions, Mono -is- slowest. Until..
 maximum optimalization is used. Then the Mono results are about 5
 times as good as with Microsoft.NET. Another weird thing is that
 normally, method 1 is way faster, but when Mono is used with maximum
 optimalization, method 2 is faster. And when the version with a
 resolution of a power of two is ran, both method 2 and 3 are faster.
 Just take a look at the pdf :)

Even without the attachment -- array bounds checks. In the first case
you need one check and in the second case you need two. But when array
bounds checks are removed (with -O=all), the second version can use some
internal magic to get it done faster.

Bear in mind that it may not be possible to always remove array bounds
checks.

-- 
: Michal Moskal :: http://www.kernel.pl/~malekith :: GCS !tv h e+++ b++
: ::: Logic is a nice contrast to the Real World. :: UL$ C++ E--- a?
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Array benchmark

2004-10-09 Thread Sijmen Mulder
 Forgot the attachment?

Here they are. The exported txt file doesn't look to good, though, but
it'll be clear.

-- 

 'May the Lord bless you and protect you. May the Lord smile on you
and be gracious to you. May the Lord show you his favor and give you
his peace.'
 'De Heer zegent je, en Hij bewaart je. De Heer kijkt met liefde naar
je, en Hij is je genadig. De Heer bedenkt het goede voor je, en geeft
je vrede.'

Sijmen Mulder
using System;
using Microsoft.Win32;

namespace ArrayBench
{
delegate float TestMethod();

class Program1000
{
const int size = 1000;
long endTime;

TestMethod[] tests;

void start()
{
endTime = DateTime.Now.Ticks+1;
}

bool stop()
{
return DateTime.Now.Ticks=endTime;
}

float linear()
{
int[] array = new int[size*size];
int   count = 0;
int   temp;

start();
while(!stop())
{
count++;
for(int y=0; ysize; y++)
for(int x=0; xsize; x++)
temp = array[y*size+x];
 
}

return count;
}

float linmatrix()
{
int[,] array = new int[size,size];
intcount = 0;
inttemp;

start();
while(!stop())
{
count++;
for(int y=0; ysize; y++)
for(int x=0; xsize; x++)
temp = array[x,y]; 
 
}

return count;
}

float matrix()
{
int[][] array = new int[size][];
int count = 0;
int temp;

for(int i=0; isize; i++)
array[i] = new int[size];

start();
while(!stop())
{
count++;
for(int y=0; ysize; y++)
for(int x=0; xsize; x++)
temp = array[x][y];
 
}

return count;
}

public Program1000()
{
tests = new TestMethod[]
{
new TestMethod(linear),
new TestMethod(linmatrix),
new TestMethod(matrix)
};
}

public void Run()
{
RegistryKey key = Registry.LocalMachine.OpenSubKey(
HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0);
string name  = (string)key.GetValue(Identifier);
intspeed = (int)key.GetValue(~MHz);

Console.WriteLine({0} at {1} MHz, name, speed);
Console.WriteLine();

Console.WriteLine(Testing {0}*{0}, size);
foreach(TestMethod test in tests)
{
Console.Write(Running {0}: , test.Method.Name);
Console.WriteLine({0}, test());
}
Console.WriteLine();
}
}

class Program1024
{
const int size = 1024;
long endTime;

TestMethod[] tests;

void start()
{
endTime = DateTime.Now.Ticks+1;
}

bool stop()
{
return DateTime.Now.Ticks=endTime;
}

float linear()
{
int[] array = new int[size*size];
int   count = 0;
int   temp;

start();
while(!stop())
{
count++;
for(int 

Re: [Mono-list] Array benchmark

2004-10-09 Thread tei
OFF-TOPIC
--
Sijmen Mulder wrote:
On a game development forum, someone asked what method of storing 2D
arrays is faster. On .NET, there are three possibilities:
1. [y*width+x]
2. [x,y]
3. [x][y]
4. [offset + x]
offset = columOffset[y]
cellContent = map[ offset + x ]
will be need to populate columoffset with values:
 columOffset[i]= (i - 1) * width
I cheat because I dont use a 2D array. I know is Ok to cheat coding 
videogames, anyway. You dont really need to draw 2 zimbillions of trigs 
If you can cheat and draw only 200 and gamers will not notice.

I was wondering too, so I wrote a benchmarker.
cool.
I attached the source
and the results (as pdf). The results are remarkable!
where? maybe this mail list remove attchs.
With all methods with all resolutions, Mono -is- slowest. Until..
maximum optimalization is used. Then the Mono results are about 5
times as good as with Microsoft.NET. Another weird thing is that
normally, method 1 is way faster, but when Mono is used with maximum
optimalization, method 2 is faster. And when the version with a
resolution of a power of two is ran, both method 2 and 3 are faster.
Just take a look at the pdf :)
Looks like you may need to force il code and compare what code is 
generated.  You are optimizing very tigth loops, so its critical the 
compiler optimizations.  Its Mono cool enough to temporaly disable 
optimizations???

#pragma disable inline expansion
code that work better with inline disabled
#pragma enable inlince expansion

Even gamercoders get more speed switching to better algoritms. You can't 
optimize bubblesort beyond some limit. Better algoritms exist out here 
for most stuff... Compiler oriented optimizations may result slow with a 
different compiler, version, client hardware, etc..

--Tei
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] VB? Or just C#?

2004-10-09 Thread Jambunathan Jambunathan
Donahue

It would  help us a lot if you could send across the error page returned 
by  the server or better still your aspx pages.

So I can only make a guess what the problem could be.  

 Error message: (0,0) : error : THIS IS STILL ALPHA AND UNSUPPORTED
 SOFTWARE, USE AT YOUR OWN RISK.

VBCodeCompiler used to consider the above ALPHA notice as an error.
This was fixed in VBCodeCompiler.cs (part of System.dll) sometime back.

To rule out this spurious error you can either 1) compile System.dll from 
cvs HEAD and install the same or 2) Upgrade to the  latest mono 1.0.1 
packages.


Regards,
Jambunathan K.


 David P. Donahue [EMAIL PROTECTED] 10/09/04 6:21 AM 
I managed to make the same small test page on a machine running Visual
Studio .NET 2003, just to test the updated Microsoft.VisualBasic.dll and
see if that solved the problem.  Now when I try to browse to the page
(which is just a button and a label) I get the following error page:



Server Error in '/gwcc/test' Application
Compilation Error
Description: Error compiling a resource required to service this
request. Review your source file and modify it to fix this error.

Error message: (0,0) : error : THIS IS STILL ALPHA AND UNSUPPORTED
SOFTWARE, USE AT YOUR OWN RISK.

File name: /home/www/.www/gwcc/test/Global.asax

Source File:

Line 1: No assembly returned after compilation!?



Also, I don't know if I mentioned this before or if it makes a
difference, but I'm running mod_mono in Apache 1.3.31 on Slackware 10.0.

What could be causing this?


Regards,
David P. Donahue
[EMAIL PROTECTED] 




 -Original Message-
 From: B Anirban [mailto:[EMAIL PROTECTED] 
 Sent: Monday, October 04, 2004 5:25 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] 
 Subject: RE: [Mono-list] VB? Or just C#?
 
 
 Hi David,
 
 This problem is occurring since you have an older version of 
 Microsoft.VisualBasic dll.
 And mono is not yet equipped for remapping this assembly to 
 the newer version automatically. Please report bug in 
 bugzilla (bugzilla.ximian.com) on this against mbas.
 
 Thanks.
 Anirban.
 
  David P. Donahue [EMAIL PROTECTED] 04-Oct-04 12:45:52 AM
 
 I just wrote a very, very simple ASP .NET project in using VB 
 .NET in Visual Studio .NET and tried to run it on mono.  The 
 project is just one page with a button that, when pressed, 
 changes a label.  I created the page on the localhost on my 
 Windows XP machine, build the solution in Visual Studio, then 
 copied all the files to a folder shared by my Apache server 
 (running mono) on my Linux box.  When I attempt to access the 
 page, I get a stack trace that ends with a file not found 
 error for the .dll (even though it is there) and see the 
 following in my Apache error log:
 
 ** (/usr/local/bin/mod-mono-server.exe:10038): WARNING **: 
 Could not find assembly Microsoft.VisualBasic, references 
 from /home/www/.www/gwcc/test/bin/gwcc.dll (assemblyref_index=1)
  Major/Minor: 7,0
  Build:   3300,0
  Token:   b03f5f7f11d50a3a
 
 Should this be happening, or am I doing something wrong?
 
 
 Regards,
 David P. Donahue
 [EMAIL PROTECTED] 
 
 
 
 
  -Original Message-
  From: Juan Cristóbal Olivares [mailto:[EMAIL PROTECTED] 
  Sent: Sunday, September 12, 2004 4:16 PM
  To: David P. Donahue; [EMAIL PROTECTED] 
  Subject: Re: [Mono-list] VB? Or just C#?
  
  
  Mono does not have a VB.NET compiller. You could compile your
  VB.NET site with .NET (Windows) and the run it with Mono.
  
  Juan Cristóbal Olivares
  
  - Original Message -
  From: David P. Donahue [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Saturday, September 11, 2004 7:49 PM
  Subject: [Mono-list] VB? Or just C#?
  
  
   Can Mono compile ASP .NET websites written in VB, or is it
  limited to
   only C#?  If it can, I'm having trouble finding documentation on
   how...
  
  
   David P. Donahue
  
   ___
   Mono-list maillist  -  [EMAIL PROTECTED] 
   http://lists.ximian.com/mailman/listinfo/mono-list 
  
  
 
 ___
 Mono-list maillist  -  [EMAIL PROTECTED] 
 http://lists.ximian.com/mailman/listinfo/mono-list 
 

___
Mono-list maillist  -  [EMAIL PROTECTED] 
http://lists.ximian.com/mailman/listinfo/mono-list
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] How many strings do I have?

2004-10-09 Thread Jonathan Pryor
On Fri, 2004-10-08 at 04:39, Jeroen Frijters wrote:
 Jonathan Gilbert wrote:
  Once a string is in the pool, it can NEVER be removed
  (until the AppDomain is disposed).
 
 In Java the string intern pool uses weak references. I don't know about
 .NET, but I'd hope it does the same.

I believe it doesn't.  From [1]:

Interning happens two ways in the CLR.
... 

2) It happens automatically, when you load an assembly.  All the
string literals in the assembly are interned.  This is
expensive and  in retrospect  may have been a mistake.  In the
future we might consider allowing individual assemblies to
opt-in or opt-out

 - Jon

[1] http://blogs.msdn.com/cbrumme/archive/2003/04/22/51371.aspx

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] VB? Or just C#?

2004-10-09 Thread David P. Donahue
 It would  help us a lot if you could send across the error 
 page returned 
 by  the server or better still your aspx pages.

The error page returned reads as follows:

--
Server Error in '/gwcc/test' Application
Compilation Error
Description: Error compiling a resource required to service 
this request. Review your source file and modify it to fix this error.

Error message: (0,0) : error : THIS IS STILL ALPHA AND 
UNSUPPORTED SOFTWARE, USE AT YOUR OWN RISK.

File name: /home/www/.www/gwcc/test/Global.asax

Source File:

Line 1: No assembly returned after compilation!?
--
 
 So I can only make a guess what the problem could be.  
 
  Error message: (0,0) : error : THIS IS STILL ALPHA AND UNSUPPORTED 
  SOFTWARE, USE AT YOUR OWN RISK.
 
 VBCodeCompiler used to consider the above ALPHA notice as 
 an error. This was fixed in VBCodeCompiler.cs (part of 
 System.dll) sometime back.
 
 To rule out this spurious error you can either 1) compile 
 System.dll from 
 cvs HEAD and install the same or 2) Upgrade to the  latest mono 1.0.1 
 packages.

I was using mono 1.0.1, sorry I didn't specify that earlier.  I just
installed mono 1.0.2 but am having the same problem.  Should I push into
1.1.1 (development version) or is that not recommended?



Regards,
David P. Donahue
[EMAIL PROTECTED]

 
 
 Regards,
 Jambunathan K.
 
 
  David P. Donahue [EMAIL PROTECTED] 10/09/04 6:21 AM 
 I managed to make the same small test page on a machine 
 running Visual Studio .NET 2003, just to test the updated 
 Microsoft.VisualBasic.dll and see if that solved the problem. 
  Now when I try to browse to the page (which is just a button 
 and a label) I get the following error page:
 
 --
 --
 
 Server Error in '/gwcc/test' Application
 Compilation Error
 Description: Error compiling a resource required to service 
 this request. Review your source file and modify it to fix this error.
 
 Error message: (0,0) : error : THIS IS STILL ALPHA AND 
 UNSUPPORTED SOFTWARE, USE AT YOUR OWN RISK.
 
 File name: /home/www/.www/gwcc/test/Global.asax
 
 Source File:
 
 Line 1: No assembly returned after compilation!?
 --
 --
 
 
 Also, I don't know if I mentioned this before or if it makes 
 a difference, but I'm running mod_mono in Apache 1.3.31 on 
 Slackware 10.0.
 
 What could be causing this?
 
 
 Regards,
 David P. Donahue
 [EMAIL PROTECTED] 
 
 
 
 
  -Original Message-
  From: B Anirban [mailto:[EMAIL PROTECTED]
  Sent: Monday, October 04, 2004 5:25 AM
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED] 
  Subject: RE: [Mono-list] VB? Or just C#?
  
  
  Hi David,
  
  This problem is occurring since you have an older version of
  Microsoft.VisualBasic dll.
  And mono is not yet equipped for remapping this assembly to 
  the newer version automatically. Please report bug in 
  bugzilla (bugzilla.ximian.com) on this against mbas.
  
  Thanks.
  Anirban.
  
   David P. Donahue [EMAIL PROTECTED] 04-Oct-04 12:45:52 AM
  
  I just wrote a very, very simple ASP .NET project in using VB
  .NET in Visual Studio .NET and tried to run it on mono.  The 
  project is just one page with a button that, when pressed, 
  changes a label.  I created the page on the localhost on my 
  Windows XP machine, build the solution in Visual Studio, then 
  copied all the files to a folder shared by my Apache server 
  (running mono) on my Linux box.  When I attempt to access the 
  page, I get a stack trace that ends with a file not found 
  error for the .dll (even though it is there) and see the 
  following in my Apache error log:
  
  ** (/usr/local/bin/mod-mono-server.exe:10038): WARNING **:
  Could not find assembly Microsoft.VisualBasic, references 
  from /home/www/.www/gwcc/test/bin/gwcc.dll (assemblyref_index=1)
   Major/Minor: 7,0
   Build:   3300,0
   Token:   b03f5f7f11d50a3a
  
  Should this be happening, or am I doing something wrong?
  
  
  Regards,
  David P. Donahue
  [EMAIL PROTECTED]
  
  
  
  
   -Original Message-
   From: Juan Cristóbal Olivares [mailto:[EMAIL PROTECTED]
   Sent: Sunday, September 12, 2004 4:16 PM
   To: David P. Donahue; [EMAIL PROTECTED] 
   Subject: Re: [Mono-list] VB? Or just C#?
   
   
   Mono does not have a VB.NET compiller. You could compile 
 your VB.NET 
   site with .NET (Windows) and the run it with Mono.
   
   Juan Cristóbal Olivares
   
   - Original Message -
   From: David P. Donahue [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Saturday, September 11, 2004 7:49 PM
   Subject: [Mono-list] VB? Or just C#?
   
   
Can Mono compile ASP .NET websites written in VB, or is it
   limited to
only C#?  If it can, I'm having trouble finding 
 documentation on 
how...
   
   
David P. Donahue
   

Re: [Mono-list] EntryPointNotFoundException: map_Mono_Posix_PollEvents

2004-10-09 Thread Jonathan Pryor
On Fri, 2004-10-08 at 11:21, Shaun Jackman wrote:
 I am not completely familiar with the C# platform. Are the .exe files
 that mono generates cross-platform? For example, can I expect the same
 exe to run on Linux, Win32 and Pocket PC platforms?

You can, with some limitations.  Basically, the code the .exe
contains/uses must be present on all platforms you try to run it on. :-)

So if you use (e.g.) System.EnterpriseServices, it'll likely only run on
.NET, and not Rotor, PNet, Mono, or Pocket PC.

While System.Collections should exist on all those platforms.

Another exception is mixed-code assemblies -- assemblies that contain
both native and managed code.  Currently, only Managed Extensions to C++
can generate such assemblies, and such assemblies CANNOT be run on
multiple platforms (nor should you expect them to, as a PowerPC can't
run x86 code without introducing an emulator...).

 - Jon


___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Using the mono jay parser

2004-10-09 Thread Francis Brosnan Blázquez
Hi,

We are developing an application using mono which have to parse
molecular definitions written in Smiles format. We have already use
bison and flex tools to produce scanners and parsers before, so we want
to keep doing the same ;).

We have started to figure out how mono uses the jay modified version to
produce its c# parser but we are having some problems. One problem is
that we don't find how mono produces its scanner. What lexer is mono
using?. The other problem is that we haven't found much documentation on
how to use jay (not how to use lex and yacc languages) to produce a
parser. 

It would be great to have some guidelines to start. Anything will be
appreciated: files to look, ideas, concepts on how to use your modified
jay...

Cheers,

-- 
Francis Brosnan Blázquez [EMAIL PROTECTED]
Advanced Software Production Line, S.L.

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Client side validation

2004-10-09 Thread Michael J. Ryan
sarvesh wrote:
Now the bad news.
1. None of the client side scripts work on non-Microsoft browsers. Now
i haven't been able find out any details about this. Can the
developers throw some light on this. Will client validation not work
on non-MS browsers only if they are ported from visual studio? i don't
know and i haven't been able to figure out.
There are other, 3rd party validation controls, and you can build your
own, that could support other browsers... Unfortunately the stock ones don't
work with other than IE.
--
Michael J. Ryan - tracker1(at)theroughnecks(dot)com - www.theroughnecks.net
icq: 4935386  -  AIM/AOL: azTracker1  -  Y!: azTracker1  -  MSN/Win: (email)
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] FC2 yum repository for 1.1.1

2004-10-09 Thread Mark Lewis
I don't see gtk-sharp or related packages (monodoc, monodevelop, etc)
anywhere in the fc2 yum repository for 1.1.1
(http://www.go-mono.com/archive/1.1.1/fedora-2-i386/).


Also, trying to install the mono-complete rpm doesn't pull these in as
dependencies.

Are these not supported in 1.1.x yet?  Can I install from source if I
need them?  Is it possible to mix the 1.0.x versions of these packages
with the rest of the 1.1.x packages?

Thanks,
Mark

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] FC2 yum repository for 1.1.1

2004-10-09 Thread Duncan Mak
On Sat, 2004-10-09 at 14:05 -0700, Mark Lewis wrote:
 I don't see gtk-sharp or related packages (monodoc, monodevelop, etc)
 anywhere in the fc2 yum repository for 1.1.1
 (http://www.go-mono.com/archive/1.1.1/fedora-2-i386/).
 
 Also, trying to install the mono-complete rpm doesn't pull these in as
 dependencies.

There is no gtk-sharp 1.1 release. To get gtk-sharp packages, please get
it from the 1.0.x repository.

As for mono-complete, it's a meta-package to install all of the mono-*
packages. It is possible that we will ship something like
mono-complete-environment or some such that will include everything we
distribute.

Finally, if you want gtk-sharp, you should then install gtk-sharp. The
dependency tree for gtk-sharp will (if not, please report the bug) pull
in all of its mono requirements.

-- 
Duncan Mak [EMAIL PROTECTED]
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list