Carlos,

AFAIK you don't create more objects. Is exactly the same, the difference is 
that instead of making thousands of calls to GetEncoding , and going several 
times through the switch statement, you just do it once... We didn't detect 
a hit on memory consumption (I will double check), but peformance hit is 
great!


==========
The only problem with that will be with the amount of memory used by the
charsets if we do that in tha way.

As it's now there will be Encoding instances on ly in the charsets that
are being used, while if we do it in the ctor there will be Encoding
instances for all charsets.

This could be a problem wehen working with the compact framework.

Maybe i can try to do the change (for the 2.1.0 sources) using
conditional code ....

----- Original Message ----- 
From: "pablosantosluac" <[EMAIL PROTECTED]>
To: "Carlos Guzmán Álvarez" <[EMAIL PROTECTED]>
Cc: "For users and developers of the Firebird .NET providers" 
<[email protected]>
Sent: Monday, April 16, 2007 12:59 PM
Subject: [Firebird-net-provider] Big performance gain on Charset.cs


> Hi all,
>
> We are heavily relying on Firebird for our version control product, 
> Plastic
> SCM, and we have just found a big performance boost making a small change 
> on
> Charset.cs.
>
> On our tests we have reduced overall time around 20% just changing the
> following on Charset.cs, so we thought you might be interested:
>
> instead of making the following switch statement each time a GetBytes was
> invoked:
> switch (this.systemName)
>
> {
>
> case "NONE":
>
> mEncoding = Encoding.Default;
>
> break;
>
> case "OCTETS":
>
> mEncoding = new BinaryEncoding();
>
> break;
>
> default:
>
> mEncoding = Encoding.GetEncoding(this.systemName);
>
> break;
>
> }
>
>
>
> We have moved it to the constructor and created a member variable
> (mEncoding) to create the right one.
>
> Afaik, the behaviour is still right, but performance is about 20% better.
>
>
>
> Cheers,
>
>
>
> pablo
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Firebird-net-provider mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/firebird-net-provider 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to