Skip to content
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 serialization/deserialization of nat8[]/blob #249

Closed
lastmjs opened this issue May 2, 2022 · 3 comments · Fixed by #429
Closed

Optimize serialization/deserialization of nat8[]/blob #249

lastmjs opened this issue May 2, 2022 · 3 comments · Fixed by #429
Assignees
Labels
breaking change This PR contains a breaking change
Milestone

Comments

@lastmjs
Copy link
Member

lastmjs commented May 2, 2022

I suspect a massive point of inefficiency with Azle is serialization/deserialization of nat8[]/blob. This presenting with this error when trying to send in blobs/nat8[]s as parameters to canister methods:

Error: The Replica returned an error: code 5, message: "Canister rrkah-fqaaa-aaaaa-aaaaq-cai exceeded the cycles limit for single message execution."

The limit seems to be between 10kb-25kb, but I believe in Rust and Motoko you can go all the way to the message limit and pass things in around 1-3mb in size. So we're a good couple orders of magnitude off.

@lastmjs
Copy link
Member Author

lastmjs commented May 3, 2022

Follow this issue: boa-dev/boa#2058

@lastmjs lastmjs added this to the 1.0 milestone May 25, 2022
@lastmjs
Copy link
Member Author

lastmjs commented May 25, 2022

Implement this example once this is resolved: #248

@lastmjs lastmjs self-assigned this May 26, 2022
@lastmjs lastmjs modified the milestones: 1.0, June May 26, 2022
@lastmjs
Copy link
Member Author

lastmjs commented Jun 18, 2022

  • AzleIntoJsValue just for Vec using ArrayBuffer
  • AzleTryFromJsValue just for Vec using ArrayBuffer
  • AzleIntoJsValue for all number vecs using ArrayBuffer
  • AzleTryFromJsValue fro all number vecs using ArrayBuffer
  • Open up issues or pull requests into boa to make conversion of Vec etc easier
  • Deal with non-public boa branch (open up issues to get this addressed)
  • Add AzleIntoJsValue and AzleTryFromJsValue vec transformations for all custom struct and enums (add to the derive macros) (might not have to do this because of the one weird trick)
  • Consider not converting everything into an ArrayBuffer, but instead into the actual typed arrays...we might need to mess with the TypeScript types to get this to work, I am not sure if we can alias nat8[] to something that isn't an array of numbers
  • Add tests for all number array types
  • Add tests for struct/enums as parameters?
  • All existing tests should pass

@lastmjs lastmjs added the breaking change This PR contains a breaking change label Jun 22, 2022
@lastmjs lastmjs closed this as completed Jun 22, 2022
@lastmjs lastmjs reopened this Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change This PR contains a breaking change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant