René's URL Explorer Experiment


Title: Dissolve small pure workers into saturated call sites (#211) by Unisay · Pull Request #285 · purescript-lua/purescript-lua · GitHub

Open Graph Title: Dissolve small pure workers into saturated call sites (#211) by Unisay · Pull Request #285 · purescript-lua/purescript-lua

X Title: Dissolve small pure workers into saturated call sites (#211) by Unisay · Pull Request #285 · purescript-lua/purescript-lua

Description: Closes #211. Problem Issue #211 predates two changes that reshaped its landscape: the Capture/Complexity inlining lattices (#231) and the bare-primop worker unfolding (#281). #281 already dissolves sub$w(v, 1) into v - 1, but its predicate demands a single primop node over Trivial operands, so anything one step richer kept paying a Lua call per saturated site: local Golden_Uncurry_Test_alwaysFirst_S_w = function(x) return x end local Golden_Uncurry_Test_adderOf_S_w = function(x, y) return function(y_S_229) return x + y + y_S_229 end end local Golden_Uncurry_Test_add3_S_w = function(x, y, z) return x + y + z end (x + y) + z is a nested primop (the left operand is not Trivial), return x is not a primop at all, and a projection-chain operand like r.foo prices Deref, one notch above Trivial. All three declined. Change isBarePrimOpBody becomes isCheapWorkerBody: a tree of primops, equality tests and negations over leaves complexityOf classifies at most Deref (parameter references, scalar literals, cheap projection chains), possibly under nested lambdas. The paste is additionally bounded by smallInlineBudget — the constant whose documented meaning is exactly "duplication at every use site": isCheapWorkerBody ∷ RawExp ann → Bool isCheapWorkerBody = \case PrimBinOp _ _ a b → isCheapWorkerBody a && isCheapWorkerBody b Eq _ a b → isCheapWorkerBody a && isCheapWorkerBody b PrimNot _ e → isCheapWorkerBody e AbsN _ _params body → isCheapWorkerBody body leaf → complexityOf leaf <= Deref Everything else rides on existing machinery: the n-ary AbsN root is pasted under the original AppN, the exact-arity betaReduce consumes it in the same pass, and constantFolding finishes the job where arguments are literal. The former call sites in Golden.Uncurry.Test: -- before local _ = Effect_Console_logShow_S_w(Data_Show_showInt, Golden_Uncurry_Test_add3_S_w(1, 2, 3))() local _ = Effect_Console_logShow_S_w(Data_Show_showInt, Golden_Uncurry_Test_adderOf_S_w(1, 2)(3))() local _ = Effect_Console_logShow_S_w(Data_Show_showInt, Golden_Uncurry_Test_alwaysFirst_S_w(7, 8))() -- after local _ = Effect_Console_logShow_S_w(Data_Show_showInt, 6)() local _ = Effect_Console_logShow_S_w(Data_Show_showInt, 6)() local _ = Effect_Console_logShow_S_w(Data_Show_showInt, 7)() and the partially-applied residual closure folds its constants too: -- before Data_Functor_foreign.arrayMap(function(add3_S_p3_S_258) return Golden_Uncurry_Test_add3_S_w(1, 2, add3_S_p3_S_258) end) -- after Data_Functor_foreign.arrayMap(function(add3_S_p3_S_259) return 3 + add3_S_p3_S_259 end) All three workers above are gone from the output entirely: once every saturated site is inlined, DCE drops the worker, and the late uncurry run leaves the surviving manifest chain alone because a binding with no saturated site is never split. What deliberately stays shared IfThenElse bodies are not admitted, deviating from the issue's original allowed list: an IfThenElse in expression position lowers through chunkToExpression to a per-call IIFE — the exact allocation the case-of-case rules of #203 exist to remove — so pasting a decision tree would trade a named call for a closure allocation plus a call. Application bodies (sumTo$w, evenSteps$w, logShow$w, the monad workers), allocating bodies (Ctor, non-empty literals, Let) and oversized trees also keep sharing, each declining through the complexityOf fallback or the budget. Value-position uses are untouched by construction: the rule fires only at saturated AppN heads, so the sharing-vs-Capture concern that #231 codified for the local tiers never arises (no lambda literal lands in a branch or closure position — it is consumed by betaReduce on the spot). The issue's original sketch — extending the shared isInlinableExpr guard so the binding dissolves before uncurry — would have bypassed the CaptureNone gate of isDuplicatableClosedAbs and pasted lambda literals into value positions (the #204 trace-abort pathology). Keeping the admission per-call-site delivers the same end state for call uses while leaving every value use a shared reference, so this lands as a completion of #211 in the post-#231/#281 architecture rather than a literal transcription. Testing Unit tests mirror the #281 spec block: three positives (nested primop tree, parameter-selecting body, Deref-leaf operands — red before the change) and three negatives pinning the exclusions (application body, branching body, over-budget tree — green before and after). Golden churn is limited to Golden.Uncurry.Test, Golden.UncurriedLift.Test and Golden.Unbinding.Test; every eval oracle passes unchanged, and the full suite is stable across four hspec seeds (1, 42, 20260716, 999983).

Open Graph Description: Closes #211. Problem Issue #211 predates two changes that reshaped its landscape: the Capture/Complexity inlining lattices (#231) and the bare-primop worker unfolding (#281). #281 already dissolves...

X Description: Closes #211. Problem Issue #211 predates two changes that reshaped its landscape: the Capture/Complexity inlining lattices (#231) and the bare-primop worker unfolding (#281). #281 already dissolves...

Opengraph URL: https://github.com/purescript-lua/purescript-lua/pull/285

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:3d9af3ca-7999-0077-b4b1-add171229ab9
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA642:2E124E:6FF4B1:907C80:6B00E484
html-safe-nonce60973095b50f01a3640b675a451a9c66a5ab001345ff14a147b1f06bd3525717
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjQyOjJFMTI0RTo2RkY0QjE6OTA3QzgwOjZCMDBFNDg0IiwidmlzaXRvcl9pZCI6IjUyNDI0MTEzNzc5MTM1NTQwNTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmace32f05cd4f3bb2a0599e334650de067b8892165eb41f178bd837626e5d531250
hovercard-subject-tagpull_request:4068884632
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/purescript-lua/purescript-lua/pull/285/files
twitter:imagehttps://avatars.githubusercontent.com/u/1009751?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1009751?s=400&v=4
og:image:altCloses #211. Problem Issue #211 predates two changes that reshaped its landscape: the Capture/Complexity inlining lattices (#231) and the bare-primop worker unfolding (#281). #281 already dissolves...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/purescript-lua/purescript-lua git https://github.com/purescript-lua/purescript-lua.git
octolytics-dimension-user_id131581790
octolytics-dimension-user_loginpurescript-lua
octolytics-dimension-repository_id587200487
octolytics-dimension-repository_nwopurescript-lua/purescript-lua
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id587200487
octolytics-dimension-repository_network_root_nwopurescript-lua/purescript-lua
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
release624179fb8b88d26ba5bba08894eb60a1c5a1d93d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/purescript-lua/purescript-lua/pull/285/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpurescript-lua%2Fpurescript-lua%2Fpull%2F285%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%2Fpurescript-lua%2Fpurescript-lua%2Fpull%2F285%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=purescript-lua%2Fpurescript-lua
Reloadhttps://github.com/purescript-lua/purescript-lua/pull/285/files
Reloadhttps://github.com/purescript-lua/purescript-lua/pull/285/files
Reloadhttps://github.com/purescript-lua/purescript-lua/pull/285/files
purescript-luahttps://github.com/purescript-lua
purescript-luahttps://github.com/purescript-lua/purescript-lua
Codehttps://github.com/purescript-lua/purescript-lua
Issues48 (48)https://github.com/purescript-lua/purescript-lua/issues
Pull requestshttps://github.com/purescript-lua/purescript-lua/pulls
Discussionshttps://github.com/purescript-lua/purescript-lua/discussions
Actionshttps://github.com/purescript-lua/purescript-lua/actions
Projectshttps://github.com/purescript-lua/purescript-lua/projects
Security and qualityhttps://github.com/purescript-lua/purescript-lua/security
Insightshttps://github.com/purescript-lua/purescript-lua/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fpurescript-lua%2Fpurescript-lua%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpurescript-lua%2Fpurescript-lua%2Fissues%2Fnew%2Fchoose
Unisayhttps://github.com/Unisay
mainhttps://github.com/purescript-lua/purescript-lua/tree/main
issue-211/inline-small-pure-bindingshttps://github.com/purescript-lua/purescript-lua/tree/issue-211/inline-small-pure-bindings
Conversation 5 https://github.com/purescript-lua/purescript-lua/pull/285
Commits 3 https://github.com/purescript-lua/purescript-lua/pull/285/commits
Checks 2 https://github.com/purescript-lua/purescript-lua/pull/285/checks
Files changed https://github.com/purescript-lua/purescript-lua/pull/285/files
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/285/files
Dissolve small pure workers into saturated call sites (#211) https://github.com/purescript-lua/purescript-lua/pull/285/files#top
Show all changes 3 commits https://github.com/purescript-lua/purescript-lua/pull/285/files
364c3a8 feat(optimizer): dissolve small pure workers into saturated call site… Unisay Jul 16, 2026 https://github.com/purescript-lua/purescript-lua/pull/285/commits/364c3a8dd1aae777236ca2ea103908e4de96fbdf
5efad1e test(golden): accept dissolved small pure workers (#211) Unisay Jul 16, 2026 https://github.com/purescript-lua/purescript-lua/pull/285/commits/5efad1ee3e3934e468677d732079ece330b5722b
f8aee38 address copilot review on PR #285 Unisay Jul 17, 2026 https://github.com/purescript-lua/purescript-lua/pull/285/commits/f8aee38709fbef251726341180657ec05868dba6
Clear filters https://github.com/purescript-lua/purescript-lua/pull/285/files
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/285/files
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/285/files
20260716_150000_unisay_small_pure_worker_inline.md https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-ba8942da310a0a717148d005895240df598a14d776280077f1131a528c502165
Optimizer.hs https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
Spec.hs https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
golden.ir https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-a559761aa2d50499078c1dffefc10a2059f624aa287fcf60a4458ad68e7c91ef
golden.lua https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-0d605363feef9c9f59d23144823c0d5b0fb2ab769934673fcd273183badc9a95
golden.ir https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-9f1799ede16b2de76bbd9ce943935d297b0b2196125598eee26cc4313177c6b4
golden.lua https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-5921e666a0348af0dd78380b07fead46422cafb2d7dadb38988ae54c01af9164
golden.ir https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-61f79094c925f1c00df559521926a985640236fe532d9ccec94b9893442659e3
golden.lua https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-12b1d0aa4433bf963d1b2b3685ea3ec7726991cd5b797cdb7c8ce480aa7d24dd
changelog.d/20260716_150000_unisay_small_pure_worker_inline.mdhttps://github.com/purescript-lua/purescript-lua/pull/285/files#diff-ba8942da310a0a717148d005895240df598a14d776280077f1131a528c502165
View file https://github.com/purescript-lua/purescript-lua/blob/f8aee38709fbef251726341180657ec05868dba6/changelog.d/20260716_150000_unisay_small_pure_worker_inline.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/285/{{ revealButtonHref }}
lib/Language/PureScript/Backend/IR/Optimizer.hshttps://github.com/purescript-lua/purescript-lua/pull/285/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
View file https://github.com/purescript-lua/purescript-lua/blob/f8aee38709fbef251726341180657ec05868dba6/lib/Language/PureScript/Backend/IR/Optimizer.hs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/285/{{ revealButtonHref }}
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-487ead9d0ca9c3e6f68e23c604b0ae9070089e0dd0f7d214cdce5fbc878f3315
test/Language/PureScript/Backend/IR/Optimizer/Spec.hshttps://github.com/purescript-lua/purescript-lua/pull/285/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
View file https://github.com/purescript-lua/purescript-lua/blob/f8aee38709fbef251726341180657ec05868dba6/test/Language/PureScript/Backend/IR/Optimizer/Spec.hs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/285/{{ revealButtonHref }}
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-241ea2421c606c31b9414fb386f9f4d1beb60055ed792935b393101edfd7b949
test/ps/output/Golden.Unbinding.Test/golden.irhttps://github.com/purescript-lua/purescript-lua/pull/285/files#diff-a559761aa2d50499078c1dffefc10a2059f624aa287fcf60a4458ad68e7c91ef
View file https://github.com/purescript-lua/purescript-lua/blob/f8aee38709fbef251726341180657ec05868dba6/test/ps/output/Golden.Unbinding.Test/golden.ir
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/285/{{ revealButtonHref }}
test/ps/output/Golden.Unbinding.Test/golden.luahttps://github.com/purescript-lua/purescript-lua/pull/285/files#diff-0d605363feef9c9f59d23144823c0d5b0fb2ab769934673fcd273183badc9a95
View file https://github.com/purescript-lua/purescript-lua/blob/f8aee38709fbef251726341180657ec05868dba6/test/ps/output/Golden.Unbinding.Test/golden.lua
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/285/{{ revealButtonHref }}
test/ps/output/Golden.UncurriedLift.Test/golden.irhttps://github.com/purescript-lua/purescript-lua/pull/285/files#diff-9f1799ede16b2de76bbd9ce943935d297b0b2196125598eee26cc4313177c6b4
View file https://github.com/purescript-lua/purescript-lua/blob/f8aee38709fbef251726341180657ec05868dba6/test/ps/output/Golden.UncurriedLift.Test/golden.ir
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/purescript-lua/purescript-lua/pull/285/{{ revealButtonHref }}
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-9f1799ede16b2de76bbd9ce943935d297b0b2196125598eee26cc4313177c6b4
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-9f1799ede16b2de76bbd9ce943935d297b0b2196125598eee26cc4313177c6b4
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-9f1799ede16b2de76bbd9ce943935d297b0b2196125598eee26cc4313177c6b4
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-9f1799ede16b2de76bbd9ce943935d297b0b2196125598eee26cc4313177c6b4
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-9f1799ede16b2de76bbd9ce943935d297b0b2196125598eee26cc4313177c6b4
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-9f1799ede16b2de76bbd9ce943935d297b0b2196125598eee26cc4313177c6b4
https://github.com/purescript-lua/purescript-lua/pull/285/files#diff-9f1799ede16b2de76bbd9ce943935d297b0b2196125598eee26cc4313177c6b4
Please reload this pagehttps://github.com/purescript-lua/purescript-lua/pull/285/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.