Re: Interop Marshalling Overhead - Newbie qn




"steve" <steve@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D35406B8-5A62-4A80-A8B7-D1D3B9D0D0BE@xxxxxxxxxxxxxxxx
> Almost missed something in your original reply
>
> If I'm hearing you correctly hear. If I apply a
> SuppressUnmanagedCodeSecurityAttribute to my interop calls I could reduce
> the
> interop access overhead by a factor of 4-5!
>
> Now that's worth talking about! Will look into that one, since it could
> make writing C# classes that directly call some Win32 APIs plausible.
>
> Cheers,
>
> Steve
>

Yes, that's right, SuppressUnmanagedCodeSecurityAttribute removes the
security check when calling into unmanaged code, but before you apply this
in general you should make sure you fully understand the implications at the
security level.
Note also that the few hundred cycles you save may be important for a few
simple API's you call, while for most others this overhead is simply
negligible compared to the marshaling overhead for instance. IMO you
shouldn't care about this, unless the call overhead is really a bottleneck
or in high frequency call scenarios, in which case you might have chosen the
wrong language/environment anyway.

Willy.





.



Relevant Pages

  • Re: Interop Marshalling Overhead - Newbie qn
    ... SuppressUnmanagedCodeSecurityAttribute to my interop calls I could reduce the ... interop access overhead by a factor of 4-5! ... >> expensive marshalling penalties. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Garbage collectable pinned arrays!
    ... The OP is measuring the overhead of a GCHandle.Alloc, ... exactly what is done by GCHandle.Alloc with GCHandleType.Pinned, that's why he is measuring this methods overhead. ... But interop doesn't pin implicitely, it pins the arguments when needed. ... "Pointer Table" together with some ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Interop Marshalling Overhead - Newbie qn
    ... Interop Overhead ... In my application I'm quite comfortable with the interop ... Marshalling Overhead ... int GetDataFromXYZ; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: CCW overheads
    ... It's impossible to say with only that information if COM interop ... overhead will be an issue or not for you. ... Mattias Sjögren [MVP] mattias @ mvps.org ... Please reply only to the newsgroup. ...
    (microsoft.public.dotnet.framework.interop)