[Mono-bugs] [Bug 80508][Nor] Changed - code quality regression for array init

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Jan 15 07:47:57 EST 2007

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by marek.safar at seznam.cz.


--- shadow/80508	2007-01-15 06:53:32.000000000 -0500
+++ shadow/80508.tmp.4489	2007-01-15 07:47:57.000000000 -0500
@@ -104,6 +104,28 @@
 saving about 50 KB of generated native code). Of course I can improve
 the optimization to make it faster in all the cases, even with array
 element counts less than 5. And not only that: knowing the array is
 initialized allows us to allocate it in a faster way with the Boehm
 collector (avoiding the need of zeroing the data).
+------- Additional Comments From marek.safar at seznam.cz  2007-01-15 07:47 -------
+I agree with you that 200 is too high and I would like to know you
+opinion what is the right threshold.
+Miguel suggestion was 10 and you suggested 10 or 20.
+My suggestion was:
+const_initializers_count > 8 &&
+const_initializers_count > (array_data.Count >> 1)
+I think it doesn't make sense to go lower than 8 maybe even 8 is too
+low to cover cost of managed/unmanaged call.
+Plus we have to consider the number of constant non-default
+initializers in relation to the size of array.
+I think it is too expensive to call ArrayInit when e.g. array will be
+size of 300 and only 15 items will be constants and the rest of items
+are either 0 or non-constant expressions.

More information about the mono-bugs mailing list