> Well, we have run our internal tests, and also the profiler, and changing
> this code gains 20%, so it doesn't seem to be doing exactly the same. The
> "old" code running through the switch several times, and creating an
> encoding object thousands of times too.

Well, I meant the same in terms of actual functionality. The code in
Encoding.GetEncoding caches the return value so when you call it again with
the same name, it returns the same instance as before.

The speed-up you get is from not having to convert from the string name to
an integer codepage and doing a hashtable lookup (basically what
Encoding.GetEncoding does internall). Depending on the number of times that
gets done, the speedup could be significant.

Dean.



-------------------------------------------------------------------------
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