Title: [fork-ffi] Performance audit across the Lua forks: uncurried shapes for Lua-specific foreigns, string accumulation, fallback coverage · Issue #186 · purescript-lua/purescript-lua · GitHub
Open Graph Title: [fork-ffi] Performance audit across the Lua forks: uncurried shapes for Lua-specific foreigns, string accumulation, fallback coverage · Issue #186 · purescript-lua/purescript-lua
X Title: [fork-ffi] Performance audit across the Lua forks: uncurried shapes for Lua-specific foreigns, string accumulation, fallback coverage · Issue #186 · purescript-lua/purescript-lua
Description: Problem Across the package-set forks, several latent performance and output-size concerns need auditing: Lua-specific foreigns declared in curried a -> b -> Effect c shapes (which compile to closure chains rather than direct calls), hot ...
Open Graph Description: Problem Across the package-set forks, several latent performance and output-size concerns need auditing: Lua-specific foreigns declared in curried a -> b -> Effect c shapes (which compile to closur...
X Description: Problem Across the package-set forks, several latent performance and output-size concerns need auditing: Lua-specific foreigns declared in curried a -> b -> Effect c shapes (which compile to ...
Opengraph URL: https://github.com/purescript-lua/purescript-lua/issues/186
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[fork-ffi] Performance audit across the Lua forks: uncurried shapes for Lua-specific foreigns, string accumulation, fallback coverage","articleBody":"## Problem\n\nAcross the package-set forks, several latent performance and output-size concerns need auditing: Lua-specific foreigns declared in curried `a -> b -> Effect c` shapes (which compile to closure chains rather than direct calls), hot string operations that may concatenate with `..` in recursion instead of accumulating, and dead PureScript-side `*Fallback` functions that the linker retains in output. Both audit streams are only meaningful once the compiler series makes them so, hence they are scheduled rather than immediate.\n\n## Approach\n\nTwo audit streams:\n\n**1. Uncurried shapes (after #179).** Public fork APIs cannot change (they must stay API-compatible with the registry packages), so the scope is narrow: (a) Lua-specific foreigns that do not exist upstream and use curried `a -> b -> Effect c` shapes where an `EffectFn2` would compile to a direct call once #179 lands; (b) verify the arity of every `.lua` implementation against the upstream `Fn`/`EffectFn`/`STFn` declaration it backs. Historical context that this machinery is live and error-prone: #57 (`runEffectFn10` dropped its tenth argument).\n\n**2. String accumulation and fallback coverage.** Verify hot string operations accumulate via `table.concat` rather than `..` in recursion. Also map fallback coverage: the PureScript-side `*Fallback` functions (`takeFallback`, `singletonFallback`, `codePointAtFallback`, …) are dead in practice in the Lua forks — the foreigns implement the operations natively and ignore the fallback argument — yet they stay in linked output, because DCE cannot drop an argument to an opaque foreign call.\n\n## Prerequisites / Relations\n\nStream 1 depends on #179: before it lands, `EffectFn` compiles to the same closure count as curried FFI, so the audit would be pointless. #172 provides the benchmark harness that lets each finding be defended with a number. #185's constructor-representation fork audit can be scheduled into the same pass if the timing aligns. Otherwise this is package-set-level work, independent of the compiler-side issues.\n\n## Verification / Measurement\n\nThe audit produces two concrete artefacts: (1) a list of Lua-specific curried foreigns convertible to `EffectFn`/`Fn` shapes, plus confirmed-correct arity for every `.lua` implementation against its upstream declaration; and (2) a per-fork map of live vs. dead fallbacks, answering both \"where could quadratic concatenation ever run\" (only where a fallback is live) and \"how much dead fallback code the linker retains\" (an output-size observation for the compiler side). There is no standalone speed-up number for the audit itself.\n","author":{"url":"https://github.com/Unisay","@type":"Person","name":"Unisay"},"datePublished":"2026-07-06T10:51:26Z","url":"https://github.com/purescript-lua/purescript-lua/issues/186"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e0680aa6-389b-e731-1bc6-8d815d1ce943 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D5FE:1C6C3E:753BB0:9D2620:6B00D8AD |
| html-safe-nonce | 2b7b9fb37a2a0ff818dca517984fda309f0c78a6dcc44f19226854c715b2e56b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENUZFOjFDNkMzRTo3NTNCQjA6OUQyNjIwOjZCMDBEOEFEIiwidmlzaXRvcl9pZCI6IjI4MjA5MjIzNzU2NDA1MDQ0OTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 22403959af969afad7ab8fd91f1532e66afc72ffafaa347c66dbc186ca1898a6 |
| hovercard-subject-tag | issue:4818401493 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/purescript-lua/purescript-lua/186/issue_layout |
| twitter:image | https://opengraph.githubassets.com/86bca1086ddea4248f912ee33fec2cb47f6b2b92f72e55634c06a5d6b47712ad/purescript-lua/purescript-lua/issues/186 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/86bca1086ddea4248f912ee33fec2cb47f6b2b92f72e55634c06a5d6b47712ad/purescript-lua/purescript-lua/issues/186 |
| og:image:alt | Problem Across the package-set forks, several latent performance and output-size concerns need auditing: Lua-specific foreigns declared in curried a -> b -> Effect c shapes (which compile to closur... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Unisay |
| hostname | github.com |
| expected-hostname | github.com |
| None | a481f62a1e04c9b9bdcb5628230682c66d59006f5b13b080f79cba84a176905b |
| turbo-cache-control | no-preview |
| go-import | github.com/purescript-lua/purescript-lua git https://github.com/purescript-lua/purescript-lua.git |
| octolytics-dimension-user_id | 131581790 |
| octolytics-dimension-user_login | purescript-lua |
| octolytics-dimension-repository_id | 587200487 |
| octolytics-dimension-repository_nwo | purescript-lua/purescript-lua |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 587200487 |
| octolytics-dimension-repository_network_root_nwo | purescript-lua/purescript-lua |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 84c8c5cc25e2fb7f2308428458538436baecc6d2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width