开发者

P/Invoke coarsening

开发者 https://www.devze.com 2023-04-04 08:38 出处:网络
I wonder whether .NET CLR supports P/Invoke coarsening. For example if开发者_运维技巧 we have three subsequent P/Invoke calls that deal with blittable types:

I wonder whether .NET CLR supports P/Invoke coarsening.

For example if开发者_运维技巧 we have three subsequent P/Invoke calls that deal with blittable types:

Native.DrawPolygon(1.0f, 1.0);
Native.DrawPolygon(2.0f, 1.0);
Native.DrawPolygon(3.0f, 1.0);

then we could perform managed-to-unmanaged context switch for the whole block just once, instead of doing it pointlessly three times.


No, the framework doesn't do this. You would have to build your API to minimise the managed-to-unmanaged switches.

0

精彩评论

暂无评论...
验证码 换一张
取 消