[Mono-list] Unable to create more than 1000 objects.

Rodrigo Kumpera kumpera at gmail.com
Tue Dec 13 22:43:13 EST 2011


Hi,

Interesting benchmark, I'll see what's causing this massive slowdown.

Mind detailing your environment a bit?



On Wed, Dec 14, 2011 at 12:33 AM, Dragony <cschmid at rapidshare.com> wrote:

> SGen does not crash at all. Where did I say this? Its just really really
> slow
> and I measured its many times slower than Boehm, even below 4 GB. To really
> pinpoint what I mean, here is a short program.
> Its written so that it does not crash on both versions (to clarify, it WILL
> crash on Boehm if you create a few more objects).
>
> using System;
> using System.Collections.Generic;
>
> class Test {
>  static int numUnits = 43000000;
>  static List<Unit> units = new List<Unit>(numUnits);
>   static public void Main () {
>     for (int i = 0; i < numUnits; i++) units.Add(new Unit());
>  }
> }
>
> class Unit {
>  int[] dummy = new int[10];
>   static int units = 0;
>  public Unit() {
>     if (++units % 1000000 == 0)
> Console.WriteLine(DateTime.Now.ToString("HH:mm:ss.FFFF") + "> " + units + "
> units need " + (GC.GetTotalMemory(false) / 1000000).ToString() + " MB
> Ram.");
>  }
> }
>
>
> Runtime with Boehm:
>
> 03:20:18.7026> 1000000 units need 441 MB Ram.
> 03:20:18.9418> 2000000 units need 538 MB Ram.
> 03:20:19.0799> 3000000 units need 636 MB Ram.
> 03:20:19.2181> 4000000 units need 733 MB Ram.
> 03:20:19.4811> 5000000 units need 830 MB Ram.
> 03:20:19.6194> 6000000 units need 927 MB Ram.
> 03:20:19.7581> 7000000 units need 1024 MB Ram.
> 03:20:19.8969> 8000000 units need 1122 MB Ram.
> 03:20:20.2482> 9000000 units need 1219 MB Ram.
> 03:20:20.3864> 10000000 units need 1316 MB Ram.
> 03:20:20.5247> 11000000 units need 1413 MB Ram.
> 03:20:20.663> 12000000 units need 1511 MB Ram.
> 03:20:20.8014> 13000000 units need 1608 MB Ram.
> 03:20:20.9396> 14000000 units need 1705 MB Ram.
> 03:20:21.3836> 15000000 units need 1802 MB Ram.
> 03:20:21.5218> 16000000 units need 1900 MB Ram.
> 03:20:21.6599> 17000000 units need 1997 MB Ram.
> 03:20:21.798> 18000000 units need 2094 MB Ram.
> 03:20:21.9361> 19000000 units need 2191 MB Ram.
> 03:20:22.0742> 20000000 units need 2289 MB Ram.
> 03:20:22.2126> 21000000 units need 2386 MB Ram.
> 03:20:22.3511> 22000000 units need 2483 MB Ram.
> 03:20:22.4897> 23000000 units need 2580 MB Ram.
> 03:20:22.6283> 24000000 units need 2678 MB Ram.
> 03:20:23.241> 25000000 units need 2775 MB Ram.
> 03:20:23.38> 26000000 units need 2872 MB Ram.
> 03:20:23.5184> 27000000 units need 2969 MB Ram.
> 03:20:23.657> 28000000 units need 3067 MB Ram.
> 03:20:23.7952> 29000000 units need 3164 MB Ram.
> 03:20:23.9338> 30000000 units need 3261 MB Ram.
> 03:20:24.0722> 31000000 units need 3358 MB Ram.
> 03:20:24.2106> 32000000 units need 3455 MB Ram.
> 03:20:24.349> 33000000 units need 3553 MB Ram.
> 03:20:24.4874> 34000000 units need 3650 MB Ram.
> 03:20:24.6256> 35000000 units need 3747 MB Ram.
> 03:20:24.7637> 36000000 units need 3844 MB Ram.
> 03:20:24.9021> 37000000 units need 3942 MB Ram.
> 03:20:25.0406> 38000000 units need 4039 MB Ram.
> 03:20:25.9081> 39000000 units need 4136 MB Ram.
> 03:20:26.0465> 40000000 units need 4233 MB Ram.
> 03:20:26.1847> 41000000 units need 4331 MB Ram.
> 03:20:26.3232> 42000000 units need 4428 MB Ram.
> 03:20:26.4614> 43000000 units need 4525 MB Ram.
>
> real    0m8.950s
> user    0m16.309s
> sys     0m2.260s
>
> Conclusion: Its fast the whole time. No real slow down seen.
>
> Now compare the same program run with mono-sgen:
>
> 03:23:22.2939> 1000000 units need 458 MB Ram.
> 03:23:22.7394> 2000000 units need 569 MB Ram.
> 03:23:23.2681> 3000000 units need 680 MB Ram.
> 03:23:23.5976> 4000000 units need 796 MB Ram.
> 03:23:23.9388> 5000000 units need 906 MB Ram.
> 03:23:24.3061> 6000000 units need 1017 MB Ram.
> 03:23:24.7033> 7000000 units need 1128 MB Ram.
> 03:23:25.1555> 8000000 units need 1244 MB Ram.
> 03:23:26.3505> 9000000 units need 1354 MB Ram.
> 03:23:26.894> 10000000 units need 1465 MB Ram.
> 03:23:27.4923> 11000000 units need 1576 MB Ram.
> 03:23:28.1671> 12000000 units need 1691 MB Ram.
> 03:23:28.8646> 13000000 units need 1802 MB Ram.
> 03:23:29.6044> 14000000 units need 1913 MB Ram.
> 03:23:30.3832> 15000000 units need 2024 MB Ram.
> 03:23:31.2329> 16000000 units need 2139 MB Ram.
> 03:23:32.089> 17000000 units need 2250 MB Ram.
> 03:23:32.982> 18000000 units need 2361 MB Ram.
> 03:23:33.9102> 19000000 units need 2472 MB Ram.
> 03:23:34.9125> 20000000 units need 2587 MB Ram.
> 03:23:37.7599> 21000000 units need 2698 MB Ram.
> 03:23:38.8113> 22000000 units need 2809 MB Ram.
> 03:23:39.8978> 23000000 units need 2920 MB Ram.
> 03:23:41.0666> 24000000 units need 3035 MB Ram.
> 03:23:42.2259> 25000000 units need 3146 MB Ram.
> 03:23:43.4203> 26000000 units need 3257 MB Ram.
> 03:23:44.6501> 27000000 units need 3367 MB Ram.
> 03:23:45.9678> 28000000 units need 3483 MB Ram.
> 03:23:47.2719> 29000000 units need 3594 MB Ram.
> 03:23:48.6229> 30000000 units need 3705 MB Ram.
> 03:23:50.0124> 31000000 units need 3815 MB Ram.
> 03:23:51.495> 32000000 units need 3931 MB Ram.
> 03:23:52.9577> 33000000 units need 4042 MB Ram.
> 03:23:54.4549> 34000000 units need 4152 MB Ram.
> 03:23:55.9894> 35000000 units need 4263 MB Ram.
> 03:23:57.624> 36000000 units need 4379 MB Ram.
> 03:23:59.2312> 37000000 units need 4490 MB Ram.
> 03:24:00.8733> 38000000 units need 4600 MB Ram.
> 03:24:02.5511> 39000000 units need 4711 MB Ram.
> 03:24:04.3367> 40000000 units need 4827 MB Ram.
> 03:24:06.0863> 41000000 units need 4938 MB Ram.
> 03:24:07.8749> 42000000 units need 5048 MB Ram.
> 03:24:09.6985> 43000000 units need 5159 MB Ram.
>
> real    0m56.547s
> user    0m48.935s
> sys     0m7.604s
>
> Conclusion: It needs around 15% more ram and still is 8 times slower. The
> worst thing is that it goes slower and slower the more it grows. Imagine
> the
> slow down with a really big Heap!
> I am no SGen hater, so lets tune the hell out of SGen:
>
> export MONO_GC_PARAMS='major=marksweep-par,nursery-size=64m' ; time
> mono-sgen slow.exe
> 03:26:54.0065> 1000000 units need 488 MB Ram.
> 03:26:54.2714> 2000000 units need 565 MB Ram.
> 03:26:54.67> 3000000 units need 719 MB Ram.
> 03:26:55.256> 4000000 units need 796 MB Ram.
> 03:26:55.6675> 5000000 units need 950 MB Ram.
> 03:26:55.9236> 6000000 units need 1027 MB Ram.
> 03:26:56.3483> 7000000 units need 1181 MB Ram.
> 03:26:56.6101> 8000000 units need 1258 MB Ram.
> 03:26:57.047> 9000000 units need 1413 MB Ram.
> 03:26:57.3189> 10000000 units need 1490 MB Ram.
> 03:26:58.6793> 11000000 units need 1567 MB Ram.
> 03:26:59.1473> 12000000 units need 1721 MB Ram.
> 03:26:59.4347> 13000000 units need 1798 MB Ram.
> 03:26:59.9207> 14000000 units need 1952 MB Ram.
> 03:27:00.2154> 15000000 units need 2029 MB Ram.
> 03:27:00.7163> 16000000 units need 2183 MB Ram.
> 03:27:01.0212> 17000000 units need 2260 MB Ram.
> 03:27:01.5369> 18000000 units need 2414 MB Ram.
> 03:27:01.8464> 19000000 units need 2491 MB Ram.
> 03:27:02.3764> 20000000 units need 2646 MB Ram.
> 03:27:02.6966> 21000000 units need 2723 MB Ram.
> 03:27:03.0175> 22000000 units need 2800 MB Ram.
> 03:27:03.5672> 23000000 units need 2954 MB Ram.
> 03:27:03.8983> 24000000 units need 3031 MB Ram.
> 03:27:07.4412> 25000000 units need 3185 MB Ram.
> 03:27:07.7919> 26000000 units need 3262 MB Ram.
> 03:27:08.4114> 27000000 units need 3416 MB Ram.
> 03:27:08.782> 28000000 units need 3493 MB Ram.
> 03:27:09.4273> 29000000 units need 3648 MB Ram.
> 03:27:09.8059> 30000000 units need 3725 MB Ram.
> 03:27:10.47> 31000000 units need 3879 MB Ram.
> 03:27:10.8616> 32000000 units need 3956 MB Ram.
> 03:27:11.2563> 33000000 units need 4033 MB Ram.
> 03:27:11.9427> 34000000 units need 4187 MB Ram.
> 03:27:12.3441> 35000000 units need 4264 MB Ram.
> 03:27:13.0506> 36000000 units need 4418 MB Ram.
> 03:27:13.4612> 37000000 units need 4495 MB Ram.
> 03:27:14.1824> 38000000 units need 4649 MB Ram.
> 03:27:14.6039> 39000000 units need 4726 MB Ram.
> 03:27:15.3486> 40000000 units need 4881 MB Ram.
> 03:27:15.7788> 41000000 units need 4958 MB Ram.
> 03:27:16.5469> 42000000 units need 5112 MB Ram.
> 03:27:16.9931> 43000000 units need 5189 MB Ram.
>
> real    0m34.585s
> user    0m27.994s
> sys     0m9.777s
>
> Conclusion: WOW! Suddenly much faster. Maybe crappy default values? But
> even
> with this tuning, its 34 seconds compared to 9 seconds with Boehm.
>
> Today I converted a few classes to heavy arrays instead of objects... But
> seriously, thats no fun at all. If I start like this, I can go back to C as
> well....
>
>
> --
> View this message in context:
> http://mono.1490590.n4.nabble.com/Unable-to-create-more-than-1000-objects-tp4184397p4193427.html
> Sent from the Mono - General mailing list archive at Nabble.com.
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20111214/5b8b10ee/attachment-0001.html 


More information about the Mono-list mailing list