René's URL Explorer Experiment


Title: perf(runtime): skip unread BroadcastChannel deliveries and let idle channels be collected by edusperoni · Pull Request #2086 · NativeScript/android · GitHub

Open Graph Title: perf(runtime): skip unread BroadcastChannel deliveries and let idle channels be collected by edusperoni · Pull Request #2086 · NativeScript/android

X Title: perf(runtime): skip unread BroadcastChannel deliveries and let idle channels be collected by edusperoni · Pull Request #2086 · NativeScript/android

Description: Android counterpart of NativeScript/ios#543, kept in sync with it. What Every open BroadcastChannel deserialized every message posted on its name and dispatched two MessageEvents, even with no listener. The first went on the hidden port, and a relay listener re-wrapped it onto the channel. A channel was also held strongly until close(). Fire-and-forget senders such as new BroadcastChannel(n).postMessage(x) therefore stayed as group members forever, and each paid that cost on every later post. Changes Delivery checks for listeners on the channel. The channel reports its own message/messageerror listener count through the kListenerChanged hook, the same one MessagePort uses. While it has a listener, native holds the channel as the port's delivery target and dispatches one MessageEvent directly on it. Without a listener, a drained message is discarded unread: no deserialization, no event, no microtask checkpoint. The check runs at delivery, not at post. A message posted before onmessage is attached in the same turn is still delivered, as in browsers. Lifetime follows HTML's GC rule. That delivery target is the only strong reference to the channel. An open channel with no listener can be collected, which is also what Chromium, WebKit and Gecko do, and a FinalizationRegistry closes its port so it leaves the group. Destination order. Group members are kept in join order, so destinations on one isolate are served in channel creation order as HTML specifies, rather than in pointer order. Unstarted ports. A MessagePort that hasn't been started is no longer woken for every incoming burst; only its close sentinel wakes it. The native side is the same change as iOS, ported onto Android's Messaging.cpp. broadcast-channel.js is now byte-identical across both runtimes. Numbers Measured on iOS (Release, simulator) with the same native design. I didn't benchmark Android separately. 10 silent peers, 50-item payload: 132.5 µs → 7.9 µs per message, which is about the cost of postMessage itself. 500 fire-and-forget senders: 294 µs → 9 µs per send. Deliberate differences From Node: Node keeps an unclosed channel alive until close()/unref(). This runtime now follows the browsers and HTML instead. Proxy-wrapped channels: a listener added through a Proxy around a channel reaches the channel's listener list, but the hook sees the proxy and cannot reach the port. Messages are then discarded. Out of scope Ordering with more than one message in flight: one drain per port serves its whole backlog. On one isolate, two channels receiving two messages run A1, A2, B1, B2 instead of HTML's A1, B1, A2, B2. This predates the change. Tests test-app/app/src/main/assets/app/tests/testMessaging.js gains the same 10 BroadcastChannel specs as iOS: same-turn attach discard while unheard stop/resume with listener changes a single event dispatched at the channel creation order collection with no listener, after the last listener is removed, and after close a messageerror-only listener keeps the channel alive an unreferenced channel with a listener keeps receiving Full suite on main + this commit, on a Pixel 9 Pro API 35 arm64 emulator: 1478 specs, 0 failures, 4 skipped. The skips are unrelated to messaging. Summary by CodeRabbit New Features BroadcastChannel messages now follow channel creation order and can be delivered in the same turn. Message delivery pauses when no message listeners are registered and resumes when listeners are added. Messages received without listeners are discarded. BroadcastChannel cleanup now handles garbage collection, including channels with active listeners. Bug Fixes Closing a broadcast channel no longer emits a close event, and listener and onmessage handlers receive a single dispatch per message.

Open Graph Description: Android counterpart of NativeScript/ios#543, kept in sync with it. What Every open BroadcastChannel deserialized every message posted on its name and dispatched two MessageEvents, even with no list...

X Description: Android counterpart of NativeScript/ios#543, kept in sync with it. What Every open BroadcastChannel deserialized every message posted on its name and dispatched two MessageEvents, even with no list...

Opengraph URL: https://github.com/NativeScript/android/pull/2086

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e048e0fa-652d-040b-f008-35e6c670741f
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB990:14F601:2509AC4:2F0058E:6B0170DC
html-safe-nonce4e190b49f77e56953407838f7c4e60136784451c8597304eb51663637089303e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTkwOjE0RjYwMToyNTA5QUM0OjJGMDA1OEU6NkIwMTcwREMiLCJ2aXNpdG9yX2lkIjoiNTIyNzMyNzYxOTI1MTIwMjIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmaca3ca4128acabdf6c534e2072c1b5fb18e735b3abb31baa913dc19101749c6f8e
hovercard-subject-tagpull_request:5177132528
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/NativeScript/android/pull/2086/files
twitter:imagehttps://avatars.githubusercontent.com/u/4061767?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/4061767?s=400&v=4
og:image:altAndroid counterpart of NativeScript/ios#543, kept in sync with it. What Every open BroadcastChannel deserialized every message posted on its name and dispatched two MessageEvents, even with no list...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/NativeScript/android git https://github.com/NativeScript/android.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id29137950
octolytics-dimension-repository_nwoNativeScript/android
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id29137950
octolytics-dimension-repository_network_root_nwoNativeScript/android
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/NativeScript/android/pull/2086/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fandroid%2Fpull%2F2086%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fandroid%2Fpull%2F2086%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=NativeScript%2Fandroid
Reloadhttps://github.com/NativeScript/android/pull/2086/files
Reloadhttps://github.com/NativeScript/android/pull/2086/files
Reloadhttps://github.com/NativeScript/android/pull/2086/files
NativeScripthttps://github.com/NativeScript
androidhttps://github.com/NativeScript/android
Codehttps://github.com/NativeScript/android
Issues106 (106)https://github.com/NativeScript/android/issues
Pull requests26 (26)https://github.com/NativeScript/android/pulls
Actionshttps://github.com/NativeScript/android/actions
Projectshttps://github.com/NativeScript/android/projects
Wikihttps://github.com/NativeScript/android/wiki
Security and qualityhttps://github.com/NativeScript/android/security
Insightshttps://github.com/NativeScript/android/insights
Sign up for GitHub https://github.com/signup?return_to=%2FNativeScript%2Fandroid%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FNativeScript%2Fandroid%2Fissues%2Fnew%2Fchoose
edusperonihttps://github.com/edusperoni
mainhttps://github.com/NativeScript/android/tree/main
perf/broadcast-channel-idle-channelshttps://github.com/NativeScript/android/tree/perf/broadcast-channel-idle-channels
Conversation 1 https://github.com/NativeScript/android/pull/2086
Commits 1 https://github.com/NativeScript/android/pull/2086/commits
Checks 8 https://github.com/NativeScript/android/pull/2086/checks
Files changed https://github.com/NativeScript/android/pull/2086/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2086/files
perf(runtime): skip unread BroadcastChannel deliveries and let idle channels be collected https://github.com/NativeScript/android/pull/2086/files#top
Show all changes 1 commit https://github.com/NativeScript/android/pull/2086/files
71719d1 perf(runtime): skip unread BroadcastChannel deliveries and let idle c… edusperoni Nov 5, 2026 https://github.com/NativeScript/android/pull/2086/commits/71719d1c358e75af1cafeb6a7f58dd02a5ee8f73
Clear filters https://github.com/NativeScript/android/pull/2086/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2086/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2086/files
testMessaging.js https://github.com/NativeScript/android/pull/2086/files#diff-5ccfdc56f7ca4f349093e9d70b2342aa9590b99b78316ca51618a7f75766f55f
Messaging.cpp https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
Messaging.h https://github.com/NativeScript/android/pull/2086/files#diff-167ae7f20af1abc29baba04de40c5ef01ec2a298b675d5869a7c664f94d7e0ec
broadcast-channel.js https://github.com/NativeScript/android/pull/2086/files#diff-0860bf0acbf46e1d4ef1175716d9d2539a4168d5486b0439b8a76e3c43ffad8f
message-channel.js https://github.com/NativeScript/android/pull/2086/files#diff-e81eb36d31f07c8c2f6f6beca9b7ead6897e32aeed12fdff07acce0e93c7366e
test-app/app/src/main/assets/app/tests/testMessaging.jshttps://github.com/NativeScript/android/pull/2086/files#diff-5ccfdc56f7ca4f349093e9d70b2342aa9590b99b78316ca51618a7f75766f55f
View file https://github.com/NativeScript/android/blob/71719d1c358e75af1cafeb6a7f58dd02a5ee8f73/test-app/app/src/main/assets/app/tests/testMessaging.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2086/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/2086/files#diff-5ccfdc56f7ca4f349093e9d70b2342aa9590b99b78316ca51618a7f75766f55f
https://github.com/NativeScript/android/pull/2086/files#diff-5ccfdc56f7ca4f349093e9d70b2342aa9590b99b78316ca51618a7f75766f55f
test-app/runtime/src/main/cpp/Messaging.cpphttps://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
View file https://github.com/NativeScript/android/blob/71719d1c358e75af1cafeb6a7f58dd02a5ee8f73/test-app/runtime/src/main/cpp/Messaging.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2086/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
https://github.com/NativeScript/android/pull/2086/files#diff-e0e0c32f536b0b13eb0d0e24ca35eae8a829d7993bc06bedab5337338072f411
Please reload this pagehttps://github.com/NativeScript/android/pull/2086/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2086/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.