Skip to content

Conversation

@osa1
Copy link
Member

@osa1 osa1 commented Jul 18, 2025

This syncs the web JSON decoder used internally.

The new decoder uses js_interop instead of the Dart standard library to
improve performance when compiled to JS.

Benchmarks

master, JS:

protobuf_from_json_string(RunTimeRaw): 1423.134328358209 us.

PR, JS:

protobuf_from_json_string(RunTimeRaw): 971 us. 

Wasm and VM benchmarks don't change as they keep using the old implementation.

The new implementation is slower with Wasm as it does more JS interop, so we keep using the old one.

osa1 added 5 commits July 18, 2025 09:54
In preparation for adding conditional imports to be able to use
different encoding/decoding implementation based on the platform, this
PR creates an "internal" library and exports some of the important types
for encoding/decoding like `FieldInfo`, `PbFieldType` (renamed as
`PbFieldTypeInternal`).

This syncs some of cl/613649886.
@osa1 osa1 marked this pull request as ready for review July 18, 2025 09:57
@osa1 osa1 requested a review from devoncarew July 18, 2025 09:57
Base automatically changed from field_type_public to master July 23, 2025 10:15
@osa1
Copy link
Member Author

osa1 commented Jul 23, 2025

@devoncarew PTAL.

Copy link
Contributor

@devoncarew devoncarew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few comments; but given:

This syncs the web JSON decoder used internally.

I think we can consider the code reviewed. I think my only blocking comment is that we should update the CI here to test against the vm, dart2js, and dart2wasm.

@osa1 osa1 requested a review from devoncarew July 28, 2025 10:18
@osa1
Copy link
Member Author

osa1 commented Jul 28, 2025

@devoncarew PTAL. We should merge #1031 first, then rebase and merge this one.

@osa1 osa1 changed the title Sync web decoders Sync JSON web decoders Jul 28, 2025
@osa1 osa1 merged commit 44ecd74 into master Jul 28, 2025
11 checks passed
@osa1 osa1 deleted the web_json_decoder branch July 28, 2025 19:39
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.

3 participants