[Mono-dev] Patch for IPAddress.cs

Alan McGovern alan.mcgovern at gmail.com
Sat Mar 24 22:16:00 EDT 2007


Ok, more performance ;) The SwapInt() method is now 40% faster than when i
originally started and SwapLong() is now 50% faster than the original
method. This means i do 15 iterations of converting a long in 8500ms, which
isn't that much slower than the MS one (6700ms)

All i did this time was remove the extra bit shifts. Instead of shifting
across by 48, then &'ing then shifting back by 8 i just shifted across by 40
and &'ed there.

Patch attached. Let me know if it's OK to commit.

Alan.

On 3/25/07, Gareth Pearce <tilps.kilm at gmail.com> wrote:
>
>
> >
> >     >
> >     > However, as a comparison, the MS.NET <http://MS.NET>
> >     <http://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.
>
> --Gareth
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070325/bafe2a8c/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipaddress.patch
Type: text/x-patch
Size: 1813 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070325/bafe2a8c/attachment.bin 


More information about the Mono-devel-list mailing list