-
Notifications
You must be signed in to change notification settings - Fork 584
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
perf: Encode messages in mobile as byte arrays #3077
Conversation
10ecf5d
to
8154a56
Compare
@@ -22,12 +22,12 @@ describe('WebViewMessageStream', () => { | |||
expect(await responsePromise).toBe(555); | |||
|
|||
expect(mockWebViewA.injectJavaScript).toHaveBeenCalledWith( | |||
`window.postMessage('eyJ0YXJnZXQiOiJiIiwiZGF0YSI6MTExfQ==')`, | |||
`window.postMessage([123,34,116,97,114,103,101,116,34,58,34,98,34,44,34,100,97,116,97,34,58,34,83,89,78,34,125])`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the size increase not of concern? Does this work with very large Snap bundles etc.?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually posting the message is slightly slower yes, but we save a lot of time encoding/decoding. Seems worth it even with the size increase.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3077 +/- ##
==========================================
- Coverage 94.88% 94.88% -0.01%
==========================================
Files 506 506
Lines 11121 11120 -1
Branches 1708 1708
==========================================
- Hits 10552 10551 -1
Misses 569 569 ☔ View full report in Codecov by Sentry. |
8154a56
to
b20df4f
Compare
b20df4f
to
7c7c37b
Compare
Base64 encoding/decoding seems to be a significant overhead for the boot message on mobile. Encoding the messages as bytes instead have proven to be more performant, but still has overhead.