[Mono-devel-list] [PATCH] Faster array bounds checking

Ben Maurer bmaurer at users.sourceforge.net
Thu Apr 1 14:46:21 EST 2004


The attached patch makes mini use the compare reg,membase operation when
it is doing array bounds checking. so, rather than:

mov length_reg, [array+length_offset]
cmp index,length_reg

we get

cmp index, [array+length_offset]

The speedup was pretty big for a simple test case:
[benm at Ben tmp]$ /devel/mono/mono/mini/mono array.exe
[benm at Ben tmp]$ mono array.exe

The number is the time in ms to do an array scan (the test is attached).

I got no regressions on the test suites.

Miguel has recommended that to avoid any legal issues, I license this
under the x11 license, so:

This patch is licensed under the MIT/X11 License.

-- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mini-fast-array-checks.patch
Type: text/x-patch
Size: 7418 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040401/8cb0bee1/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array.cs
Type: text/x-csharp
Size: 299 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040401/8cb0bee1/attachment-0001.bin 

More information about the Mono-devel-list mailing list