Bug 316255 (MONO68453) - Performance problems with ldftn in wrapper functions
Summary: Performance problems with ldftn in wrapper functions
Status: RESOLVED FIXED
Alias: MONO68453
Product: Mono: Runtime
Classification: Mono
Component: misc (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Ben Maurer
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-17 00:14 UTC by Ben Maurer
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
First attempt at a patch. (5.54 KB, patch)
2004-10-17 00:14 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:56:30 UTC


---- Reported by bmaurer@users.sf.net 2004-10-16 17:14:02 MST ----

Today, we use ldftn in wrapper functions in order to call managed code.
This is basically a workaround for a few issues. We can get much better
performance if we use a normal call.

The problem is that ldftn needs a lock to work. So, you create un-needed
contention. For example, the following test case takes a very long time to
complete on an smp box:

using System;
using System.Threading;
class X : MarshalByRefObject {
	static void Main ()
	{
		for (int i = 0; i < 4; i ++) {
			Thread t = new Thread (new ThreadStart (A));
			t.IsBackground = false;
			t.Start ();
		}
	}
	
	static void A ()
	{
		X x = new X ();
		for (int i = 0; i < 100000000; i ++)
			x.Y ();
	}
	
	void Y ()
	{
	}
}

(the wrapper in use here is the remoting one)



---- Additional Comments From bmaurer@users.sf.net 2004-10-16 17:14:47 MST ----

Created an attachment (id=166929)
First attempt at a patch.




---- Additional Comments From bmaurer@users.sf.net 2004-10-16 17:16:22 MST ----

Ok, the part in mono_marshal_get_ldfld_wrapper wasnt needed for this
(I put it in while trying to track down errors).



---- Additional Comments From vargaz@gmail.com 2004-11-01 09:16:05 MST ----

I think this is ok to check in (without the ldfld changes).



---- Additional Comments From bmaurer@users.sf.net 2004-11-04 18:23:29 MST ----

done

Imported an attachment (id=166929)

Unknown operating system unknown. Setting to default OS "Other".