[Mono-list] Fast Passing Strings to Interop without Marshaling
Bradford Stephens
bradfordstephens at gmail.com
Mon Nov 3 02:48:32 EST 2008
Greetings,
We're passing very large strings to a C program in Linux through Mono
via Interop. The C program takes a (char*), and our C# program uses a
String.
The problem is that these strings can be 100kB+, and there seems to be
a large performance impact. Often, just passing the string along takes
over 150 milliseconds.
Any suggestions on how to do this faster? Can I pass a reference to
the string or some sort of char array without Marshaling it? I'm
pretty sure the performance hit comes from copying everything during
the marshaling process. I know it can be a tricky problem because C
chars are 1 byte, and C# are 2.
Cheers,
Bradford
More information about the Mono-list
mailing list