-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
c#: Remove Copy of data during import call for base types #1122
c#: Remove Copy of data during import call for base types #1122
Conversation
…for cannoncal types. This avoid the extra copy of data in this scenario Signed-off-by: James Sturtevant <[email protected]>
@@ -1063,7 +1064,7 @@ impl Bindgen for FunctionBindgen<'_, '_> { | |||
|
|||
match direction { | |||
Direction::Import => { | |||
let import_name = self.interface_gen.type_name_with_qualifier(&Type::Id(id), true); | |||
let import_name = self.interface_gen.type_name_with_qualifier(&Type::Id(id), true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some how these two lines had tabs, while rest of the file was spaces
Using a span and fixed keyword won't work with variants due to the fact that the external import call requires different types. Nesting of the fixed commands also become unwiedly Signed-off-by: James Sturtevant <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo minor spelling and punctuation nits. Thanks!
Co-authored-by: Joel Dice <[email protected]>
A quick note for myself in the future, I did run some non scientific tests to compare speed of the various implementations:
The speed of execution difference varied but was never more than a few microseconds difference. The biggest and probably more important change here is the extra copy and allocation isn't happening on the stack. With larger byte arrays would cause a memory exception. With this change large byte arrays are not an issue. |
failure doesn't look related: |
When calling an import we don't need to copy data to a new structure for canonical types. This avoid the extra copy of data in this scenario.
This isin prep for some more changes with #1080