c#: Remove Copy of data during import call for base types#1122
Merged
jsturtevant merged 3 commits intobytecodealliance:mainfrom Jan 16, 2025
Merged
c#: Remove Copy of data during import call for base types#1122jsturtevant merged 3 commits intobytecodealliance:mainfrom
jsturtevant merged 3 commits intobytecodealliance:mainfrom
Conversation
…for cannoncal types. This avoid the extra copy of data in this scenario Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
jsturtevant
commented
Jan 10, 2025
| 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); |
Collaborator
Author
There was a problem hiding this comment.
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 <jsturtevant@gmail.com>
dicej
approved these changes
Jan 15, 2025
Co-authored-by: Joel Dice <joel.dice@fermyon.com>
Collaborator
Author
|
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. |
Collaborator
Author
|
failure doesn't look related: |
This was referenced Jan 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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