Bug 1652 - sgen is significantly slower than Boehm
Summary: sgen is significantly slower than Boehm
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: GC ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Gonzalo Paniagua Javier
URL:
Depends on:
Blocks:
 
Reported: 2011-10-23 13:48 UTC by Marek Safar
Modified: 2012-01-10 16:07 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Marek Safar 2011-10-23 13:48:18 UTC
using System;

using System.Threading;

using System.Diagnostics;

using System.Threading.Tasks;



namespace test6

{

    class MainClass

    {

        public static void Main (string[] args)

        {

            var tasks = new Task<int>[10000];

            var cont = new Task[tasks.Length];



            for (int i = 0; i < tasks.Length; ++i) {

                var t = new Task<int> (() => 1);

                cont[i] = t.ContinueWith (l => { }).ContinueWith (l => {

}).ContinueWith (l => { }).ContinueWith (l => { }).ContinueWith (l => {

}).ContinueWith (l => { })

                    .ContinueWith (l => { }).ContinueWith (l => {

}).ContinueWith (l => { }).ContinueWith (l => { }).ContinueWith (l => {

}).ContinueWith (l => { })

                    .ContinueWith (l => { }).ContinueWith (l => {

}).ContinueWith (l => { }).ContinueWith (l => { }).ContinueWith (l => {

}).ContinueWith (l => { });

                tasks[i] = t;

            }



            var sw = new Stopwatch ();

            sw.Start ();

            for (int i = 0; i < tasks.Length; ++i) {

                tasks[i].Start ();

            }



            Task.WaitAll (cont);



            sw.Stop ();

            Console.WriteLine (sw.ElapsedMilliseconds);



        }

    }

}


Mono master on amd64 4cores
Sgen: 655
Boehm: 254
Comment 1 Rodrigo Kumpera 2011-11-23 13:28:36 UTC
Gonzalo,

The TP does everything wrong with the above test. It spins the max amount of threads but all tasks are CPU bound.

It does not limit how much stuff can be queued without blocking the producer, which results in huge heaps slowing us down even further.

Sgen crawls on this test since queueing is much faster than on boehm.
Comment 2 Gonzalo Paniagua Javier 2012-01-10 16:07:04 UTC
Current master yields (i7 VM with 2 cores assigned):

$ mono test.exe
476
$ mono-sgen test.exe
389