Hey swig-users,
First, is it expected that lots of calls to a C# binding will be slow? I have wrapped a math library and assigning vectors in a mesh is much slower than native C++ (I expect this should be slow, but I figured I should ask). Second, assuming that is expected, are there any strategies for wrapping light weight types that are used in tight loops? (I would make these value types C#) Thanks! -- Jeremy
------------------------------------------------------------------------------ The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik _______________________________________________ Swig-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swig-user |
On 28 October 2016 at 15:21, Jeremy Cowles <[hidden email]> wrote:
> Hey swig-users, > > First, is it expected that lots of calls to a C# binding will be slow? I > have wrapped a math library and assigning vectors in a mesh is much slower > than native C++ (I expect this should be slow, but I figured I should ask). > Yes, for very fast running C++ functions, the overhead is often completely dominated by the marshalling cost, especially when strings are involved. > Second, assuming that is expected, are there any strategies for wrapping > light weight types that are used in tight loops? (I would make these value > types C#) Avoiding multiple calls between C++ and C# by using a chunky API rather than a chatty API is the only way I've managed to avoid this problem. Also reduce the number of parameters passed in the wrapped function as each one adds a marshalling overhead. William ------------------------------------------------------------------------------ The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik _______________________________________________ Swig-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swig-user |
Makes sense, I guess I was hoping for a silver bullet :)
I have made some vectorized APIs, using bulk mem copies instead of lots of little setters, but it completely changes the feel of the original API. Thanks! On Saturday, October 29, 2016, William S Fulton <[hidden email]> wrote: On 28 October 2016 at 15:21, Jeremy Cowles <<a href="javascript:;" onclick="_e(event, 'cvml', 'jeremy.cowles@gmail.com')">jeremy.cowles@...> wrote: ------------------------------------------------------------------------------ The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik _______________________________________________ Swig-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swig-user |
Free forum by Nabble | Edit this page |