[Mono-list] Fast Passing Strings to Interop without Marshaling

Bradford Stephens bradfordstephens at gmail.com
Mon Nov 3 15:47:09 EST 2008


Hey all,

Thanks for all the help! It turns out that the interop isn't the slow
part -- we had the timer line off by 1. The slowness is in an XML API,
which is all C# :)

On Mon, Nov 3, 2008 at 10:49 AM, Chris Howie <cdhowie at gmail.com> wrote:
> On Mon, Nov 3, 2008 at 1:17 PM, Bradford Stephens
> <bradfordstephens at gmail.com> wrote:
>> The String is actually an XML document in memory, so byte-level
>> manipulation isn't very useful. However, if we just used a byte* to
>> get 'past the barrier', then re-converted it in C to a char* (where
>> the code is faster), perhaps that would work?
>
> If by convert to char* you mean cast to char* then no, it will not
> work.  If you mean casting each element of what will be a short* to a
> char* then yes it will work (assuming that all characters are ASCII)
> but again you will be copying every character of that string
> one-by-one, which is exactly what the marshaller does anyway.
>
> --
> Chris Howie
> http://www.chrishowie.com
> http://en.wikipedia.org/wiki/User:Crazycomputers
>


More information about the Mono-list mailing list