[Mono-dev] Patch for IPAddress.cs
2a5gjx302 at sneakemail.com
Sat Mar 24 23:45:48 EDT 2007
At 12:04 PM 3/25/2007 +1000, Gareth Pearce wrote:
>> However, as a comparison, the MS.NET implementation
>> completes 15 loops of the benchmark in a mere 6718ms ;)
>On this point, I suspect AOT compilation of the .Net system assemblies
>may be making the difference. The AOT might be able to recognize
>certain patterns are equivalent to rot instructions and replace a bunch
>of shifts and masks with a set of unsigned rots.
>A 32bit reorder is rot 8 on each of the 16 bit sections and a rot 16 on
>the full variable. I think that can be done in 3 clocks on x86 - but my
>assembly is rusty.
x86 actually has an instruction whose sole purpose is to invert the byte
order of a 32-bit value. Look up BSWAP. It requires at least a 486, though.
Does mono otherwise run on 386 CPUs presently? If it is okay to exclude 386
systems (or they can be detected on-the-fly and given the alternative 3
instructions), then perhaps it would be possible to do something like
marking it as an icall and having the JIT recognize that method and inline
it as just a BSWAP.
More information about the Mono-devel-list