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

One shot Encoding and Decoding #29

Merged
merged 5 commits into from
Jun 27, 2024
Merged

One shot Encoding and Decoding #29

merged 5 commits into from
Jun 27, 2024

Conversation

tomijaga
Copy link
Member

Encodes the type and value as it scans the candid variant looking only once

performance benchmarks

Instructions

decode() encode()
Motoko (to_candid(), from_candid()) 21_778_910 7_236_572
Serde 'mo:motoko_candid' lib 1_054_078_235 2_000_977_097
Serde: One Shot 298_167_258 864_784_948
Serde: One Shot sans type inference 343_730_830 654_138_729

Heap

decode() encode()
Motoko (to_candid(), from_candid()) 433_756 376_168
Serde 'mo:motoko_candid' lib 10_441_244 -1_598_868
Serde: One Shot 18_078_612 -11_697_036
Serde: One Shot sans type inference 19_894_612 -4_651_180

Instructions are reduced at the cost of more heap allocations

@tomijaga tomijaga merged commit e94221d into main Jun 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant