-
Notifications
You must be signed in to change notification settings - Fork 7
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
Optimize messages if only fields are used #1114
Comments
@jklmnn I guess your intention was to call the external function at some point in your example? Also, did you mean to call it Get_Blob? |
You're right. I fixed that. |
What about setting of message fields? I think it shouldn't be needed for the use case. If we still would want to support it, we would have to ensure that no message conditions get violated. I suppose we only want to support state-local variables. Otherwise, we also have to consider |
I think the setting of message fields doesn't need to be supported for this optimization. The usual use case are types that are returned by platform functions. |
Sometimes message have to be returned from platform functions in session, e.g. to get an opaque value to to group multiple values. These messages are never used in another message, as a sequence element or as an opaque value:
The generated code for blob includes the returned structure that already contains the data buffer and the length field, both with the appropriate types. Now that structure is transformed into a context as it is a proper message. Since only fields of
Blob
are accessed only getters of that context are called. These getters simply return the same values the structure already contained.The optimization is to remove the context creation in that case and directly use the structure. This allows to save a significant amount of memory, code size and execution time.
This optimization cannot be done when the specific properties of a real message are required:
'Opaque
.The text was updated successfully, but these errors were encountered: