Bugzilla – Bug 316255
Performance problems with ldftn in wrapper functions
Last modified: 2007-09-15 21:24:46 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".