Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorRodrigo Kumpera <kumpera@gmail.com>2013-03-25 18:25:44 +0400
committerRodrigo Kumpera <kumpera@gmail.com>2013-03-25 18:42:01 +0400
commit4189fe3f95155ee79f2ac0db53ab14e2cf26e45e (patch)
tree54e010c1fdd82567224cc85d46eb1c58dce2eb06 /mcs
parent694f00b66fe642268f5c38443071d0acc08f1b44 (diff)
Fast path Array::Resize with small arrays.
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/corlib/System/Array.cs10
1 files changed, 8 insertions, 2 deletions
diff --git a/mcs/class/corlib/System/Array.cs b/mcs/class/corlib/System/Array.cs
index db82bdcf924..2f90fbd131b 100644
--- a/mcs/class/corlib/System/Array.cs
+++ b/mcs/class/corlib/System/Array.cs
@@ -2808,8 +2808,14 @@ namespace System
return;
T [] a = new T [newSize];
- if (length != 0)
- FastCopy (arr, 0, a, 0, Math.Min (newSize, length));
+ int tocopy = Math.Min (newSize, length);
+
+ if (tocopy < 9) {
+ for (int i = 0; i < tocopy; ++i)
+ UnsafeStore (a, i, UnsafeLoad (arr, i));
+ } else {
+ FastCopy (arr, 0, a, 0, tocopy);
+ }
array = a;
}