[Mono-devel-list] Npgsql patch for binary types

Francisco Figueiredo Jr. fxjrlists at yahoo.com.br
Fri Oct 24 12:26:51 EDT 2003


Jackson Harper wrote:
> Hello,
> 

Hello Jackson.

> 
>>This is the implementation which we already have in cvs:
>>
> 
> 
>   I couldn't find this implementation in the mcs CVS. Is it possible
> that it has not been updated yet? I did spend some time optimizing this
> method this morning and got some pretty good results. Here is my
> optimized version:
> 


Uhmmmmm, strange.
I can see it in the go-mono http cvs access and I can get it in the mono cvs
I updated it some days ago.


> private static String A (Byte[] byteArray)
> {
> 	int len = byteArray.Length;
>         char[] res = new char [len * 5];
> 
>         for (int i = 0; i <len; i++) {
>         	res [(i*5)] = '\\';
>                 res [(i*5)+1] = '\\';
>                 res [(i*5)+2] = (char) (((byteArray[i] & 0xC0) >> 6) +
> '0');
>                 res [(i*5)+3] = (char) (((byteArray[i] & 0x38) >> 3) +
> '0');
>                 res [(i*5)+4] = (char) ((byteArray[i] & 0x07) + '0');
>        }
> 
>        return new String (res);
> }
> 
> Here is a little test case (play with MaxSize):
> http://primates.ximian.com/~jackson/f.cs
> 

I played with your test case :)
An improvement of 6 times!!! Very good!

[00:015] Method A
[00:095] Method B


I already commited the code on both repositories: gborg and mono.

Thanks Jackson!

Regards,

Francisco Figueiredo Jr.




More information about the Mono-devel-list mailing list