[Mono-dev] Performance Problems on Mono with F# (maybe C#) Asyncs / Tasks

Matthias Dittrich matthi.d at googlemail.com
Fri Mar 14 16:01:03 UTC 2014


basically I noticed some performance problems on mono (linux). I have a 
unit test suite which requires some minutes to run on .net but several 
hours on mono.

Because this code is heavily using F# asyncs and tasks I tried to find 
existing bug reports of the problem.
I found the following entries:
But they all don't seem to be directly related as there are no sockets 
used, because of this I decided to use the mono profiler and check the 

I had problems with the self compiled mono profiler 
(libmono-profiler-log.so.0.0.0) I had to copy the file from the binary 
distribution (It seems like the build is broken somehow on mono master?).
For reference: I got the mighty: "The 'log' profiler wasn't found in the 
main executable nor could it be loaded from 'mono-profiler-log'."

Afer running the profiler the top results are:
Method call summary
Total(ms) Self(ms)      Calls Method name
67733962   539203     229540 
Microsoft.FSharp.Control.AsyncBuilderImpl/callA at 815:Invoke 
49135479   197016     163464 
Microsoft.FSharp.Control.AsyncBuilderImpl/resultA at 781:Invoke 
48703438    33181     162414 
Microsoft.FSharp.Control.AsyncBuilderImpl/args at 799-1:Invoke (a)
42976340 42976339       5318 (wrapper managed-to-native) 
42600383   368321     164611 
Microsoft.FSharp.Control.AsyncBuilderImpl/bindA at 793:Invoke 
37193074     1632      99251 (wrapper runtime-invoke) 
<Module>:runtime_invoke_void__this___object (object,intptr,intptr,intptr)
29263844        8      12264 (wrapper runtime-invoke) 
object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
27579799      103       4772 System.Threading.WaitHandle:WaitOne (int,bool)
25615463      185         12 System.Threading.Thread:StartInternal ()
19749208       19      10942 
System.Threading.Tasks.TpScheduler:TaskExecuterCallback (object)
19749189       19      10942 System.Threading.Tasks.Task:Execute ()
19749169       33      10942 System.Threading.Tasks.Task:ThreadStart ()
19748752       47      10942 System.Threading.ExecutionContext:Run 
19748253       90      10942 System.Security.SecurityContext:Run 
19748012       62      10942 
System.Threading.ExecutionContext/<Run>c__AnonStorey0:<>m__0 (object)
19746136       55      10942 
System.Threading.Tasks.Task/<ThreadStart>c__AnonStorey0:<>m__0 (object)
19744958       34      10942 System.Threading.Tasks.Task:InnerInvoke ()
18306055       81          5 
System.Threading.Timer/Scheduler:SchedulerThread ()
18305830        3       1896 System.Threading.WaitHandle:WaitOne (int)
16264445        1        836 

And I don't really know what that means or where the problem is sitting 
as the F# code (the top entries) should be same in mono and .net.
Can anybody help in reading the results? I have also attached the 
complete output of mprof-report (EDIT: the mailing-list doesn't allow 
attachments: https://seafile.yaaf.de/f/51c56adc26/ ). When the problem 
is identified I would be happy in helping to solve it. Are there other 
ways/tools to further analyse the problem?

Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20140314/5c180635/attachment.html>

More information about the Mono-devel-list mailing list