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

feat: add dedicated JavaScript thread support #512

Merged
merged 69 commits into from
Dec 28, 2023

Conversation

andycall
Copy link
Member

@andycall andycall commented Oct 31, 2023

RFC: openwebf/rfc#4

First version implemented by @penneryu and improved by @andycall

Use example:

DedicatedThreadGroup threadGroup = DedicatedThreadGroup();

WebF(
  bundle: WebFBundle.fromUrl('assets:assets/bundle.html'),
  runningThread: DedicatedThread(), //  Executes your JavaScript code in a dedicated thread
),
WebF(
  bundle: WebFBundle.fromUrl('assets:assets/bundle.html'),
  runningThread: FlutterUIThread(), // Executes your JavaScript code within the Flutter UI thread.
),
WebF(
  bundle: WebFBundle.fromUrl('assets:assets/bundle.html'),
  runningThread: FlutterUIThread(), // Multiple WebF instance in same thread supported.
),
_kraken = WebF(
  bundle: WebFBundle.fromUrl('assets:assets/bundle.html'),
  runningThread: threadGroup.slave(), // Executes multiple JavaScript contexts in a single thread.
),
WebF(
  bundle: WebFBundle.fromUrl('assets:assets/bundle.html'),
  runningThread: threadGroup.slave(), //  Executes multiple JavaScript contexts in a single thread.
),

Design Graph:

image

performance comparison:

Test devices: Moto Qingyou XT1799 arch: arm

Test code:

p.addEventListener('click', (e) => {
  e.data = { name: 1};
}, true);

p.addEventListener('click', (e) => {
  console.log(e.data);
}, false);
image

@andycall andycall force-pushed the feat/feat/dedicated_js_thread_v2 branch from fd15f34 to b74961b Compare November 15, 2023 15:03
@andycall andycall force-pushed the feat/feat/dedicated_js_thread_v2 branch from d504f8f to 47d0ef9 Compare November 21, 2023 16:56
@andycall andycall force-pushed the feat/feat/dedicated_js_thread_v2 branch 7 times, most recently from 38bb28b to 32d60f4 Compare November 29, 2023 12:19
@andycall andycall changed the title [WIP] feat: add dedicated JavaScript thread support feat: add dedicated JavaScript thread support Nov 29, 2023
@andycall andycall force-pushed the feat/feat/dedicated_js_thread_v2 branch 4 times, most recently from 776fd4f to 4cf7c07 Compare December 1, 2023 08:35
@andycall andycall added the enhancement New feature or request label Dec 1, 2023
@andycall andycall self-assigned this Dec 1, 2023
@andycall andycall force-pushed the feat/feat/dedicated_js_thread_v2 branch from 0b217a3 to f2adf57 Compare December 2, 2023 06:29
@andycall andycall force-pushed the feat/feat/dedicated_js_thread_v2 branch 4 times, most recently from 7e4d14b to b841321 Compare December 17, 2023 16:31
@andycall andycall force-pushed the feat/feat/dedicated_js_thread_v2 branch 5 times, most recently from 3db0328 to 4dbfca3 Compare December 27, 2023 08:35
@andycall andycall force-pushed the feat/feat/dedicated_js_thread_v2 branch from 1ecfb58 to 79dc274 Compare December 28, 2023 07:52
@andycall andycall added this pull request to the merge queue Dec 28, 2023
Merged via the queue into main with commit 4286354 Dec 28, 2023
1 check passed
@andycall andycall deleted the feat/feat/dedicated_js_thread_v2 branch December 28, 2023 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants